Crontab specification
How to specify crontab jobs and some examples
crontab -e edit
crontab -l list
min hour dayofmonth monthofyear dayofweek command
0-59/2 * * * * /usr/bin/wget -O - -q -t 1 http://my_site.com/cron.php > /dev/null 2>&1
Append string >/dev/null 2>&1 to stop mail alert:
0 1 5 10 * /path/to/script.sh >/dev/null 2>&1
OR
0 1 5 10 * /path/to/script.sh &> /dev/null
Crontab syntax field allowed values based on Debian
----- --------------
1 Minute 0-59
2 Hour 0-23 (0 = midnight)
3 Day 1-31
4 Month 1-12
5 Weekday 0-6 (0 = Sunday) Source: http://www.linuxweblog.com/crotab-tutorial
Examples:
This is how you can delay your cron jobs in crontab by adding the sleep command and the amount of seconds before the action is called. Can be used when you don't want to run cron jobs at the same time but needs to make calls more often than 1 minute.
*/5 * * * * /usr/bin/wget -O - -q -t 1 http://sub.ahsaymonitor.com/cron.php > /dev/null 2>&1
*/1 * * * * sleep 10; /hotel/ahsaymonitor.com/sub/runparser.sh
*/1 * * * * sleep 30; /hotel/ahsaymonitor.com/sub/runparser.sh
*/1 * * * * sleep 50; /hotel/ahsaymonitor.com/sub/runparser.sh