Scheduling Script Operations Within A Script

<< Click to Display Table of Contents >>

Navigation:  Robo-FTP User's Guide > Script Programming > Select Topics in Script Programming >

Scheduling Script Operations Within A Script

 

Robo-FTP provides a built in Scheduler for scheduling script executing.

 

If you need more granular control of a script's internal timing, Robo-FTP provides two script commands that can be used to schedule certain operations. Simple interval scheduling is provided by the PAUSE command. More complex pausing behavior is provided by the CRON command. In some cases, the commands may be used together.

 

Simple scheduling amounts to delaying the execution of script commands for a specified period of time or until a specified time of day. For example, the following script command delays script execution until 2:00AM.

 

PAUSE /until=2:00

 

More advanced scheduling enables scripts to be run at on certain days of the week, days of the month, and/or at various times of day. The CRON command is used for this purpose. The CRON command utilizes predefined scheduling conditions (e.g., @daily) or a cron event file (usually named "crontab.txt") that allows for multiple scheduling conditions. For example, the following script command runs a specified script file at midnight each night.

 

CRON "@daily" 'CALL "nightly.s"'

 

It is also possible to use the PAUSE and CRON commands together to achieve some of the same results. For example, since the @daily condition becomes active at midnight, you might want to have the script become active at 1:30AM instead of at midnight. To accomplish this, you could use the following script commands.

 

CRON "@daily"

PAUSE /until=1:30

CALL "nightly.s"

 

More complex scheduling is possible using the CRON script command in conjunction with the cron event file. The format of this file is complex 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.

 

Related command(s): CRON, PAUSE

See also: Scheduling File Transfers, Programming Service Scripts, Simultaneous Execution