Some of the commands commonly used by crontab are as follows
sudo crontab-l #显示所有的定时任务 sudo crontab-e #编辑任务 sudo crontab-r #删除所有的任务
Editing a task is written as follows:
Echo " Hello World " " Hello World "
Five * indicates minute-minutes, any integer from 0 to 59 hour-hours, any integer from 0 to 23 day-date, any integer from 1 to 31 (if the month is specified, must be a valid date for that month) month-month, from Any integer between 1 and 12 (or using the abbreviated abbreviation of the month such as Jan, Feb, etc.) dayofweek-week, any integer from 0 to 7, where 0 or 7 stands for Sunday (or use the English shorthand of the week such as Sun, Mon, etc.) in addition to the numbers there are a few special The symbol
* / - ,, where * represents all the values within the range of numbers, "/" represents each of the meanings, "*/2" represents every 2 units, "-" represents a number from one digit to a number, "," separates several discrete numbers. Here are a few examples to illustrate the problem:
0 6* * *Echo "Good morning.">>/tmp/morning.txt #每天早上6点打印Good Morning0*/2* * *Echo "There is a break now .">>/tmp/test.txt #每两个小时0 at-7/2,8* * *Echo "a good dream:)">>/tmp/Test.txt #晚上11点到早上8点之间每两个小时, eight in the morning.0 One 4*1-3 Echo "a">>/tmp/test.txt #每个月的4号和每个礼拜的礼拜一到礼拜三的早上11点
Reference: http://blog.csdn.net/flyhawk007blog/article/details/2689678
Linux System timing Tasks