CentOS 6.6
Default already Installed
#yum Install Crontabs
#service Crond Restart
Related commands
CRONTAB-E//Editing tasks
Crontab-l//List tasks
Crontab-r//Delete this user task
Time-sharing Weekly command
* * * * * *
The 1th column represents minutes 1~59 per minute with * or */1
The 2nd column represents the hour 1~23 (0 means 0 points)
The 3rd column represents the date 1~31
The 4th column represents the month 1~12
5th Column Identification Number Week 0~6 (0 = Sunday)
6th List of commands to run
*/1 * * * * cd/var/www &&/usr/bin/php/var/www/test.php >/dev/null 2>&1//Be sure to note that the default output directory is the user's directory, such as generating files, The specified directory requires a CD
Some examples of crontab files:
* * * * */usr/local/etc/rc.d/lighttpd restart
The above example shows that 21:30 restarts Apache per night.
4 1,10,22 * */USR/LOCAL/ETC/RC.D/LIGHTTPD restart
The above example shows that 4:45 restarts Apache on the 1, 10, and 22nd of the month.
1 * * 6,0/USR/LOCAL/ETC/RC.D/LIGHTTPD restart
The above example shows that 1:10 restarts Apache every Saturday and Sunday.
0,30 18-23 * * */usr/local/etc/rc.d/lighttpd restart
The above example shows that Apache restarts every 30 minutes from 18:00 to 23:00 every day.
* */1 * * * */usr/local/etc/rc.d/lighttpd restart
Restart Apache every hour.
* 23-7/1 * * * */usr/local/etc/rc.d/lighttpd restart
From 11 o'clock to 7 in the morning, restart Apache every hour.
0 4 * mon-wed/usr/local/etc/rc.d/lighttpd restart
4th per month with 11 points from Monday to Wednesday restarts Apache.
0 4 1 Jan */usr/local/etc/rc.d/lighttpd restart
Restart Apache at 4 o ' January 1.
Crontab Scheduled Tasks