Reference Source:
http://blog.csdn.net/ariessurfer/article/details/7459183
Http://www.jb51.net/LINUXjishu/19905.html
The cron service is a built-in service for Linux, but it does not boot automatically. You can start and stop the service with the following command:
/sbin/service Crond Start
/sbin/service Crond Stop
/sbin/service Crond Restart
/sbin/service Crond Reload
The above 1-4 lines start, stop, restart the service, and reload the configuration, respectively.
To set cron to start automatically when booting, in the/etc/rc.d/rc.local script can be added /sbin/service crond start
View current user's crontab, enter crontab-l;
Edit Crontab, enter crontab-e;
Delete crontab, enter Crontab-r
Basic format:
* * * * * command
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
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.
0 * * 6/usr/local/etc/rc.d/lighttpd restart
The above example shows the restart of Apache every Saturday at 11:00am.
* */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-point restart from Monday to Wednesday Apache
0 4 1 Jan */usr/local/etc/rc.d/lighttpd restart
4-point restart of Apache on January 1
Basic Use Method:
Crontab-e post-editing tasks to be performed regularly remember to use absolute paths
/sbin/service Crond Start Start task
"Linux" Crontab timed commands