crontab -e --> Edit your crontab file.
crontab -l --> Show your crontab file.
crontab -r --> Remove your crontab file.
crontab -v --> Display the last time you edited your crontab file
There is a fixed format for the way an entry has to be made in a cron file. I found an interesting way of showing it here which I am replicating.
* * * * * 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)
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
You can also use special entries. Below is a list for them:
Entry Description Equivalent To @reboot Run once, at startup. None @yearly Run once a year 0 0 1 1 * @annually (same as @yearly) 0 0 1 1 * @monthly Run once a month 0 0 1 * * @weekly Run once a week 0 0 * * 0 @daily Run once a day 0 0 * * * @midnight (same as @daily) 0 0 * * * @hourly Run once an hour 0 * * * *
A sample cron file looks like this.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.