Crontab command
#export to the file
crontab -l > filename
# import from the file
crontab filename
# import from the file for the specific user
crontab -u user filename
# edit
crontab -e
# delete all
crontab -r
Crontab special usage
| 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 * * * * |
reference from http://en.wikipedia.org/wiki/Cron
Crontab Example
# .---------------- minute (0 - 59) |
| min | hour | day/month | month | day/week | Execution time |
| 30 | 0 | 1 | 1,6,12 | * | -- 00:30 Hrs on 1st of Jan, June & Dec. |
: | |||||
| 0 | 20 | * | 10 | 1-5 | --8.00 PM every weekday (Mon-Fri) only in Oct. |
: | |||||
| 0 | 0 | 1,10,15 | * | * | -- midnight on 1st ,10th & 15th of month |
: | |||||
| 5,10 | 0 | 10 | * | 1 | -- At 12.05,12.10 every Monday & on 10th of every month |
| : | |||||
| */8 * * * * root init 6 | After 8 minutes , execute "reboot" command |
沒有留言:
張貼留言