Install crontab: [[email protected] ~]# yum install vixie-cron [[email protected] ~]# Yum install Crontabs
Description: The Vixie-cron package is the main program for Cron, and the Crontabs package is the program used to install, uninstall, or enumerate the tables used to drive the cron daemon. +++++++++++++++++++++++++++++++++++ Cron is a built-in service for Linux, but it does not automatically get up, you can start and shut down this service in the following ways:/sbin/service crond start//Start service/ Sbin/service Crond Stop//shutdown service/sbin/service crond restart//Restart service/sbin/service Crond Reload//Reload Configuration
View crontab Service Status: Crond status
Manually Start crontab services: Service Crond start
To see if the Crontab service is set to boot, execute command: NTSYSV
Join power on Auto start: Chkconfig--level Crond on
1,crontab command
Feature Description: Set the timer.
Syntax: crontab [-u < user name >][profile] or crontab [-u < user name >][-ELR]
Additional note: Cron is a resident service that provides the function of a timer that allows the user to execute a preset instruction or program at a specific time. The function of the timer can be used as long as the user edits the timer's configuration file. Its configuration file format is as follows: Minute Hour day Month DayOFWeek Command
Parameter:-E to edit the user's timer settings. -l lists the user's timer settings.
-R removes the user's timer settings. -u< User name > Specifies the user name to set the timer.
2,crontab format
Basic format: * * * * * * command time and Moon Week order
The 1th column represents the minute 1~59 per minute with * or */1 for the 2nd column representing the hour 1~23 (0 for 0 points) and the 3rd column represents the date 1~31 4th column represents the month 1~12 5th column identification Number Week 0~6 (0 = Sunday) 6th column to run the command
Some examples of crontab files:
* * * * * * * */USR/LOCAL/ETC/RC.D/LIGHTTPD Restart the above example indicates that 21:30 restarts Apache per night.
4 1,10,22 * */USR/LOCAL/ETC/RC.D/LIGHTTPD Restart the above example shows the 4:45 restart Apache per month for 1, 10, 22nd.
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.
0 * * 6/USR/LOCAL/ETC/RC.D/LIGHTTPD Restart the above example indicates that the Apache is restarted every Saturday.
* */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 a.m., restart Apache every hour.
0 4 * mon-wed/usr/local/etc/rc.d/lighttpd restart 4th per month with 11-point restart from Monday to Wednesday Apache
0 4 1 Jan */usr/local/etc/rc.d/lighttpd restart January 1 4-point restart Apache
*/30 * * * * */usr/sbin/ntpdate 210.72.145.44 time every half hour
The CRONTAB command has 3 main parameters:
-E: Edit the user's crontab.
-L: Lists the contents of the user's crontab.
-r: Deletes the contents of the user's crontab.
Execute CRONTAB-E, will automatically open the editor, you can edit your own crontab files, syntax and/etc/crontab files, different just, do not have to point out the execution of the user, edit and save.
Crontab-l used to view their crontab files, crontab-r delete their crontab.
CentOS installation crontab and how to use (Turn)