Topic Options
#1353 - 12/07/01 08:38 AM calling several subroutines
canadajay Offline
Junior Member

Registered: 11/16/01
Posts: 5
Loc: Montreal
How can I create a script that can call different subroutines.

For example,

If it's the 1st,2nd,3rd,4th,5th,6th of the month I would like to perform this task.

The rest of the month I would like to perform a different task.

Thanks

Top
#1354 - 12/07/01 11:20 AM Re: calling several subroutines
Luke Tomasello Administrator Offline
Member

Registered: 09/17/00
Posts: 740
Loc: San Jose, CA., USA
Sure, this is the kind of task WinCron excels at.

This script should do what you want.
I set it up to run on the 21,22,23,24 of the month, but you can change it to whatever you like.

## every_so_often
# every_so_often at 10 PM, run a job for that day.
##
# Trigger set to daily at 10PM
# Use CRON matcher to filter for those days I wish to trap:
# -action -match -cron [-except] minute hour day_of_month month day_of_week
# Where: minute=don't care, hour=don't care, day_of_month=21,22,23,24,
# month=don't care, and day_of_week=don't care
{
-name every_so_often
-start -time 10:00 PM -constrain 0 0 5 0
-action -onerror break
-action -match -cron * * 21,22,23,24 * *
# %d% expands to the day of the month
-action -call %d%
-action -inc 1 0 0 0
}

## 21 - job named 21 to match the 21st day of the month!
# Plug-in your actions here
{
-name 21
-action -print "Matched 21st of the month at " %X%
-action -print "** do stuff here **"
}


## 22 - job named 22 to match the 22nd day of the month!
# Plug-in your actions here
{
-name 22
-action -print "Matched 22nd of the month at " %X%
-action -print "** do stuff here **"
}

# Etc.... put other jobs (23,24) here ...
_________________________
Regards,
Luke Tomasello

Top


Moderator:  Luke Tomasello