Cron is a timer which checks each line
in the code and runs a command if the line and the time match.
Minimum interval is one minute. Code contains lines (text)
and each line contains trigger time and command.
Trigger time is defined with exactly 5 segments, separated with space(s) or tab(s).
Segment can be defined with a number (e.g. 14th day of the month),
range (e.g. from monday to friday), step (e.g. when hour is 0, 2, 4, 6...),
star ('*', e.g. for every day) or list (combination of number(s), range(s), step(s)).
After the time comes a command - it can be filename with arguments, script name starting with ?
or internal command starting with !.
Time segments must be written in the following order: minute (0-59), hour (0-23), day of month (1-31), month (1-12),
day of week (0-6 or 7, where 0 is the same as 7 and represents Sunday).
Comments are written with # symbol and are ignored by the Cron. # should be written before
any alphanumeric character (numbers, letters and other symbols).
# This is a comment
# Commented lines are ignored, so next line is NOT executed
# * * * * * !test Hello World
# Stars mean that the command will be triggered every minute, hour, day...
* * * * * !test Hello World
# Command will be triggered at 15:00, 2nd day of month, every month
0 15 2 * * !test Hello World
# Command will be triggered at 6:00, 6:30, 18:00, 18:30, every month, on monday
0,30 6,18 * * 1 !test Hello World
# Command will be triggered on 5, 10, 15... minute when hour is 0, 1, 2, 20, 21, 22 and month is December
*/5 0-2,20-22 * 12 * !test Hello World
# Next line executes notepad every minute
* * * * * notepad.exe
# Next line executes script.bat with arguments every minute
* * * * * C:\Temp\script.bat -x -y
# Next line executes script named "my_script" every minute
* * * * * ?my_script
Visit Wikipedia for more info about Cron.