crontab examples

* * * * * command to be executed
– – – – –
| | | | |
| | | | +—– day of week (0 – 6) (Sunday=0)
| | | +———- month (1 – 12)
| | +————— day of month (1 – 31)
| +——————– hour (0 – 23)
+————————- min (0 – 59)

Examples for Linux, Solaris, Ubuntu:

# Export everyday at 8:pm
0 20 * * * /…/export_db.sh 1>/dev/null 2>&1

# Export monday to saturday at 01:am
0 1 * * 1-6 /…/export_db.sh 1>/dev/null 2>&1

# Automatique restart of oem agent at 07:00am 10:am 01:pm 03:pm
0 07,10,13,15 * * * /…/agent_restart.sh

#Refresh once a month
30 22 1 * * /…/refresh.sh> /tmp/refesh.log

# Run a script every 10 minutes and between 8am and 10pm (On Linux you can use */10 notation instead of 0, 10, 20…)
0,10,20,30,40,50 8-22 * * * /…/check_db.ksh 1>/dev/null 2>&1

If you want to generate your own cron job, check this useful tool:
http://www.generateit.net/cron-job/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.