Add task: crontab-e0 */1 * command0 */2 * command query whether the task is added: crontab-l0 */1 *** command0 */2 *** command plus task: crontab-e 0 */1 *** command 0 */2 *** command: crontab-l 0 */1 *** command 0 */2 *** command
Basic format:
minute hour day month dayofweek command
Minute-Minute, any integer between 0 and 59
Hour-Hour, any integer between 0 and 23
Day-Date, any integer between 1 and 31 (if a month is specified, it must be the valid date of the month)
Month-The month, any integer from 1 to 12 (or the month can be abbreviated as jan or feb)
Dayofweek-Any integer between 0 and 7 in a week. here, 0 or 7 represents Sunday (or the abbreviation of a week, such as sun or mon)
Command-Command to be executed (the command can beLs/proc>/tmp/procSuch commands can also be the command to execute your own script .)
The following is an example
* *** Command
Minute, day, month, week, command column 1st indicates minute 1 ~ 59. each minute is represented by * or */1.
The first column indicates the hour 1 ~ 23 (0 indicates 0 points)
The 3rd column indicates the date 1 ~ 31
The 4th column indicates the month 1 ~ 12
The identification number of column 5th is from day of the week to day ~ 6 (0 indicates Sunday)
Example of the crontab file to be run in column 6th: 30 21 ***/usr/local/etc/rc. d/lighttpd restart
The preceding example indicates restarting apache at every night. 45 4, 10, 22 **/usr/local/etc/rc. d/lighttpd restart
The preceding example indicates that apache is restarted at on the 1st, 10th, and 22th every month. 10 1 ** 6, 0/usr/local/etc/rc. d/lighttpd restart
The preceding example indicates that apache is restarted at every Saturday and Sunday. 0, 30 18-23 ***/usr/local/etc/rc. d/lighttpd restart
The preceding example indicates that apache is restarted every 30 minutes between and every day. 0 23 ** 6/usr/local/etc/rc. d/lighttpd restart
The preceding example indicates that apache is restarted at every Saturday. **/1 ***/usr/local/etc/rc. d/lighttpd restart
Restart apache ** 23-7/1 ***/usr/local/etc/rc. d/lighttpd restart every hour
Restart apache0 11 4 * mon-wed/usr/local/etc/rc. d/lighttpd restart from PM to PM.
Restart apache0 4 1 jan */usr/local/etc/rc. d/lighttpd restart at every Monday to Wednesday.
Restart apache at on January 1, January 1
The first five fields are represented respectively: Minute: 0-59 Hours: 1-23 Date: 1-31 Month: 1-12 Week: 0-6 (0 indicates Sunday)
Some special symbols:* Indicates any time point, indicating that the segment is separated. for example, in the second end: 1-5, 1-5 points/n indicates that each n unit is executed once, for example, in the second paragraph, */1 indicates that the command is executed every one hour. You can also enter 1-23/1.
Time format order: % Y-% m-% d-% H-% M-% S