The following are a few examples of the crontab command:
• Use the following command to run a script every 5 minutes, every day:
5 * * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1
• Use the following command to run 5 minutes after midnight every day:
5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1
• Use the following command to run at 2.15 P.M. on the first of every
month—the output is mailed to Paul:
15 14 1 * * * $HOME/bin/monthly
• Use the following command to run at 10 P.M. on weekdays, send the
e-mail to ganesh@abc.com:
0 22 * * 1-5 sendmail ganesh@abc.com < ~/work/email.txt
• The sendmail utility is used for sending e-mails. We can use the mail utility
also as follows:
sendmail user@example.com < /tmp/email.txt
• The following commands are self-explanatory from text of echo:
23 0-23/2 * * * echo "run 23 minutes after midn, 2 am, 4 am,
everyday
5 4 * * sun echo "run at 5 after 4 every Sunday"
The following are a few more crontab command examples:
| Min | Hour | Day / month | Month | Day / week | Execution time |
| 45 | 0 | 5 | 1,6,12 | * | 00:45 hrs on the 5th of January, June, and December. |
| 0 | 18 | * | 10 | 1-5 | 6.00 P.M. every weekday (Monday-Friday) only in October. |
| 0 | 0 | 1,10,15 | * | * | Midnight on the 1st ,10th, and 15th of the month |
| 5,10 | 0 | 10 | * | 1 | At 12.05 and 12.10 every Monday and on the 10th of every |
- Log in to post comments

