Fields | Description | Values | Details |
---|---|---|---|
MIN | Minute field | 0 to 59 | This tell at what minute of the hour command will execute. |
HOUR | Hour Field | 0 to 23 | This tell at what hour command will execute. |
DOM | Day Of Month Field | 1 to 31 | This is Day of Month, that you want command to execute. |
MONTH | Month Field | 1 to 12 | This is the month a specified command will execute. |
DOW | Day Of Week Field | 0 to 6 | This is the Day of Week that you want a command to execute |
COMMAND | Command Field | Command to be executed | Command/Name of the script file to be executed |
* * * * * /usr/bin/script_file.sh - - - - - - | | | | | | | | | | | --> script/command to be executed | | | | ----> Day of week (0 - 6) (Sunday=0) | | | ------> Month (1 - 12) | | --------> Day of month (1 - 31) | ----------> Hour (0 - 23) ------------> Minute (0 - 59)
crontab -lTo view crontab entries of other user use below command.
crontab -u username -l
crontab -e
crontab -r
0 4 * * * /usr/bin/script.sh
0 4,16 * * * /usr/bin/script.sh
0 22 * * 0 /usr/bin/script.sh
0 */6 * * * /usr/bin/script.sh
0 9 * * 1,3,5 /usr/bin/script.sh
* * * * * /usr/bin/script1.sh; /usr/bin/script2.sh
* * * * * /usr/bin/script.sh > /var/log/cron.logIf you would like to append the output at the end of the file instead of a complete rewrite, use double closing bracket (>>) instead:
* * * * * /usr/bin/script.sh >> /var/log/cron.log
Technical Architect
Kuala Lumpur, Malaysia
I'm a Full Stack Web Developer working in a MNC and passionate of developing modern web and mobile applications.
I have designed and developed CodephpOnline & CodephpOnline Wiki platform to expatiate my coding and technology learning experiences.
In my leisure time, I write technical articles on web development such as PHP, Laravel, CodeIgniter, Mediawiki, Linux, Angular, Ionic, ReactJS, NodeJS, AJAX, jQuery, Cloud and more.