Execute the Operation command regularly, each user has own crontab, the configuration file exists under/var, cannot be edited directly.
-E Set Timer
-l lists the current timer settings
-R Delete Timer settings
-I interactive mode, to remove the timer settings to first ask
1th column 2nd Column 3 4 5 6
The 1th column represents minutes 1~59 per minute with * or */1
The 2nd column represents the hour 1~23 (0 for 0 points)
The 3rd column represents the date 1~31
The 4th column represents the month 1~12
The 5th list of the week 0~6 (0 for Sunday)
6th column the command to run
Crontab a lot of examples of writing rules, the following from the Internet to find, lazy, hey
* * * */usr/local/etc/rc.d/lighttpd restart
The above example shows a 21:30 reboot lighttpd per night.
4 1,10,22 * */USR/LOCAL/ETC/RC.D/LIGHTTPD restart
The above example represents the 4:45 restart LIGHTTPD for 1, 10, and 22nd of each month.
1 * * 6,0/USR/LOCAL/ETC/RC.D/LIGHTTPD restart
The above example shows the 1:10 restart lighttpd every Saturday and Sunday.
0,30 18-23 * * * */usr/local/etc/rc.d/lighttpd restart
The example above indicates that the LIGHTTPD is restarted every 30 minutes from 18:00 to 23:00 every day.
0 * * 6/USR/LOCAL/ETC/RC.D/LIGHTTPD restart
The above example indicates that the 11:00 PM restarts lighttpd every Saturday.
0 * * * */usr/local/etc/rc.d/lighttpd restart
Restart lighttpd every hour.
* 23-7/1 * * * */usr/local/etc/rc.d/lighttpd restart
Between 11 o'clock and 7 in the morning, restart lighttpd every hour.
0 4 * mon-wed/usr/local/etc/rc.d/lighttpd restart
4th per month with 11 points per Monday to Wednesday restart LIGHTTPD
0 4 1/USR/LOCAL/ETC/RC.D/LIGHTTPD * Restart
Restart lighttpd at 4 o ' January 1.
Special symbols
Symbolic meaning
* Indicates any time can be
-Represents a range of values
For example:
00 17-19 * * * means 17 18 19 performs the task, indicating the separation time.
For example
30 17,18,19 * * * means 17.30 18.30 19.30 Execution/n represents the number, indicating how often it is executed
Example 1
The code is as follows:
[Root@localhost ~]# crontab-l #查看定时运行的程序
* * */bin/sh/var/www/database/bak.sh
3 * * */bin/sh/var/www/database/mylinux.sh
5 * * 0/sbin/reboot
The code is as follows:
[Root@localhost ~]# crontab-e #添加, edit
Example 2
Set crontab every minute to execute the problem, today I posted up to facilitate the use of everyone, the students will drift over it
Execute */5 * * * * every five minutes
0 per hour * * * * * *
Daily Execution 0 0 * * *
Perform 0 0 * * 0 per week
0 0 1 * * * per month
Annual Implementation 0 0 1 1 *