Scheduling SFTP Uploads Using cron



While FTPGetter comes with a simple-to-use built-in task scheduler, its configuration abilities are naturally limited with what the graphical user interface can provide. If you're willing to learn a few command-line switches, you'll get all the power of the industry-standard cron scheduler.

Crontab syntax

The cron format is a simple, yet extremely powerful and fully configurable way to specify tasks that should be executed once or periodically at certain time.

There are five fields in the cron format.


* * * * *
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday =0 or =7)
| | | ------- Month (1 - 12)
| | --------- Day (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)

Any field can be filled with a star "*", which means the full range of values, or "every". The star specifies "every minute", "every hour", "every day", and so on.

Fields can also contain lists of comma-separated values, such as "1,3,7", as well as intervals, such as "1-5".

If you want an action to be executed every other day, you would specify the step after the "*" or an interval. For example, if you want the task executed every other day, you would specify "*/2", meaning exactly that - "once every two days". Naturally, a value of "0-23/2" in the "Hour" field would mean "every two hours throughout the day". Alternatively, you could specify the same value as a list "0,2,4,6,8,10,12,14,16,18,20,22". Similarly, putting a value of "*/4" into the "Minute" field will execute the task every four minutes; the value of "1-30/3" has the same meaning as "1,4,7,10,13,16,19,22,25,28".

Examples:


* * * * * *                         	Every minute

59 23 31 12 5 *                     	One minute before the end of the year, if the year end falls to Friday

									
45 17 7 6 * *                       	Every year on 7th of June at 17:45

45 17 7 6 * 2001,2002               	Once a year on 7th of June at 17:45, if the year is 2001 or 2002
                                    
0,15,30,45 0,6,12,18 1,15,31 * 1-5 *  	At 00:00, 00:15, 00:30, 00:45, 06:00, 06:15, 06:30,
                                    	06:45, 12:00, 12:15, 12:30, 12:45, 18:00, 18:15,
                                    	18:30, 18:45, on the 1st, 15th and 31st of every month 
                                        from Monday to Friday only

*/15 */6 1,15,31 * 1-5 *            	At 00:00, 00:15, 00:30, 00:45, 06:00, 06:15, 06:30,
                                    	06:45, 12:00, 12:15, 12:30, 12:45, 18:00, 18:15,
                                    	18:30, 18:45, on the 1st, 15th and 31st of every month 
                                        from Monday (yet another notation)

* * * 1,3,5,7,9,11 * *              	Every minute in January, March, May, July, September, and November

0 9 1-7 * 1 *                       	First Monday of every month at 9 am

0 0 1 * * *                         	Midnight on the first day of every month

* 0-11 * * *                        	Every minute before noon

* * * 1,2,3 * *                     	Every minute in January, February, and March

0 0 * * * *                         	Every midnight

0 0 * * 3 *                         	Every midnight on Wednesdays

Complex, multi-line records can be easily specified e.g.

0 9 1-7 * 1 *                       
0 0 1 * * *                         
The records above specify that the tasks will be executed on the first Monday of every month at 9 am and in the midnight, as well as on the first day of every month.

Back on top