CRON        Schedule script operations

Top  Previous  Next

Syntax

CRON

[ file name ]

Alt Syntax:

CRON

[ @ cond ]  [ cmd ]

Arguments:

[ file name ]

Variable or string defining a file or path name; if no path is defined Robo-FTPs working folder is used; this cron event file contains one or more scheduling conditions; if omitted, the default file is "crontab.txt" in Robo-FTP's working folder; see Cron Event File Format.

 

[ @ cond ]

Variable or string specifying one of Robo-FTP's pre-defined scheduling conditions; these conditions must begin with the '@' symbol (e.g., @hourly).

 

[ cmd ]

Optional variable or string to be stored in the %nextcmd variable; this permits a particular command to be performed when a pre-defined scheduling condition is matched; see Using the %nextcmd Variable.

Options:

none

 

 

 

This script command provides Robo-FTP with extensive scheduling capabilities which surpasses those of the PAUSE command.

 

For an overview of Robo-FTP scheduling, see Scheduling File Transfers With Robo-FTP.

 

Two forms of scheduling are supported: (1) predefined conditions for a single event (e.g., twice daily); and (2) complex user defined conditions (e.g., 4PM Monday through Friday and midnight Sunday).

 

In either case, a script command (or other character string) may be specified to be saved in the %nextcmd variable when there is a match. Often this will be a command to execute a particular script file at the time of the event. (The command would be executed in a subsequent PERFORM command.)  This command string is optional.

 

Single event scheduling is achieved using one of the following designators:

 

@yearlymidnight Jan 1
@monthlymidnight, first day of each month
@weeklymidnight, each Sunday
@dailymidnight, each day
@hourlydaily, every hour on the hour
@every2hoursdaily, every two hours beginning at midnight
@every4hoursdaily, every four hours beginning at midnight
@every6hoursdaily, every six hours beginning at midnight
@every8hoursdaily, every eight hours beginning midnight
@twicedailydaily, at midnight and noon
@onhalfhourdaily, every hour on the half hour
@everyhalfhourdaily, every half hour
@every15mindaily, every 15 minutes
@every5mindaily, every 5 minutes

 

Consider the following example where Robo-FTP sends a file every 30 minutes.

 

:loop

;; note the use of both single and double quotation marks

CRON "@onhalfhour" 'SENDFILE "30minutes.dat"'

PERFORM %nextcmd

GOTO loop

 

More complex scheduling conditions are achieved using the CRON command slightly differently and uses a file containing one or more conditions. This file is referred as a cron event file. You may use a file of any name, but if you do not specify a file name in the CRON command, Robo-FTP uses a default name of "crontab.txt".

 

The format of this file is complex (see Cron Event File Format) and not something the casual user needs to be concerned with. The CronMaker utility is provided with Robo-FTP for the direct creation and modification of cron event files.

 

Technically savvy users may want to consider the following example where Robo-FTP executes a unique script file on each weeknight at 11PM. The cron event file located in the Robo-FTP working folder, named "crontab.txt", would contain:

 

# run a script at 11PM every weekday

0 23 * * monCALL "Monday.s"
0 23 * * tueCALL "Tuesday.s"
0 23 * * wedCALL "Wednesday.s"
0 23 * * thuCALL "Thursday.s"
0 23 * * friCALL "Friday.s"

 

The Robo-FTP script file would look like:

 

:loop

CRON

PERFORM %nextcmd

GOTO loop

 

When the CRON command executes it will display a confirmation message to the console as to when the next CRON event will trigger. Using the previous example, if today is Monday at 5PM, the CRON command would confirm the next event to occur at 11PM later that day with the following message:

 

*CRON will trigger at 11:00PM today and run this command: "CALL "Monday.s""

 

When no command string is specified, the CRON command is similar to the PAUSE command in that it simply waits until there is a match in schedule time(s) before script execution is allowed to resume.

 

Important

If there are multiple trigger events in the “crontab.txt” file, be aware that CRON does not queue events that may occur at the same time. For example, if you have two events that are scheduled to trigger at 3:30PM, CRON will act only upon the first and the second will be ignored. If you need to have multiple scripts run at the same time off of a single event trigger, you should make a single corresponding script “smart” enough to use the CALL script command to run the other(s) sequentially.

 

Related Command(s): PAUSE, WORKINGDIR

See also: CronMaker Utility, Cron Event File Format, Using the %nextcmd Variable