Install Crontab:
[Root@centos ~]# Yum Install Vixie-cron
[Root@centos ~]# Yum Install Crontabs
Description
Vixie-cron packages are Cron's main programs;
The Crontabs package is a 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 close the service in the following ways:
/sbin/service crond Start//boot service
/sbin/service Crond Stop//Off service
/sbin/service crond Restart//Restart service
/sbin/service Crond Reload//Reload Configuration
See Crontab Service Status: Service Crond status
Manually start the Crontab service: Service Crond start
To see if the Crontab service is set to boot, execute command: NTSYSV
Join the boot auto start:
Chkconfig--level Crond on
1,crontab command
Feature Description: Set timer.
Syntax: crontab [-u < user name >][configuration file] or crontab [-u < user name >][-ELR]
Supplemental Note: Cron is a resident service that provides the function of timers to allow users to execute preset instructions or programs at a specific time. The timer function can be used as long as the user edits the timer's configuration file. The configuration file format is as follows:
Minute Hour Day Month DayOfWeek Command
Parameters
-e Edit the user's timer settings.
-l lists the user's timer settings.
-R Deletes the user's timer settings.
-u< User name > Specifies the name of the user to set the timer.
2,crontab format
Basic format:
* * * * command
Time-sharing and Lunar Week command
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
Some examples of crontab files:
* * * */usr/local/etc/rc.d/lighttpd restart
The above example represents 21:30 restart Apache per night.
4 1,10,22 * */USR/LOCAL/ETC/RC.D/LIGHTTPD restart
The above example represents the 4:45 reboot of Apache for 1, 10, and 22nd per month.
1 * * 6,0/USR/LOCAL/ETC/RC.D/LIGHTTPD restart
The above example shows the 1:10 reboot of Apache every Saturday and Sunday.
0,30 18-23 * * * */usr/local/etc/rc.d/lighttpd restart
The example above shows that Apache 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 11:00 PM restarts Apache 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 in the morning, restart Apache every hour.
0 4 * mon-wed/usr/local/etc/rc.d/lighttpd restart
4th per month with 11 points per Monday to Wednesday restart Apache
0 4 1/USR/LOCAL/ETC/RC.D/LIGHTTPD * Restart
Restart Apache at 4 o ' January 1.
*/30 * * * */usr/sbin/ntpdate 210.72.145.44
Sync 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 user's crontab content.
Execute CRONTAB-E, will automatically open the editor, you can edit your own crontab file, syntax and/etc/crontab file, the difference is just, do not have to point out the execution of the user, edited after save.
Crontab-l is used to view the internal energy of your crontab file, crontab-r delete your own crontab.