Many of the projects recently claimed use the contab timer to regularly complete file transmission, generation, transfer, and so on. It's quite helpful. I 've been very busy recently and haven't written a blog for a long time. Think about the time To summarize it ~
Crontab format:
1st columns minute 1 ~ 59
2nd columns hour 1 ~ 23 (0 indicates midnight)
1-3rd ~ 31
4th columns Month 1 ~ 12
5th columns in a week 0 ~ 6 (0 indicates Sunday)
6th columns of commands to run
The following is the crontab format:
Command to be run by hour, day, month, and week
Here are some examples of crontab file entries:
0 1 ***/apps/service/vscp_checking/run. Sh
Execute the run shell script one day
30 21 ***/usr/local/Apache/bin/apachectl restart
The preceding example indicates restarting Apache at every night.
45 4, 22 **/usr/local/Apache/bin/apachectl restart
The preceding example indicates that Apache is restarted at on the 1st, 10th, and 22th every month.
10 1 ** 6, 0/usr/local/Apache/bin/apachectl restart
The preceding example indicates that Apache is restarted at every Saturday and Sunday.
0, 30 18-23 ***/usr/local/Apache/bin/apachectl restart
The preceding example indicates that Apache is restarted every 30 minutes between and every day.
0 23 ** 6/usr/local/Apache/bin/apachectl restart
The preceding example indicates that Apache is restarted at every Saturday.
**/1 ***/usr/local/Apache/bin/apachectl restart
Restart Apache every hour
* 23-7/1 ***/usr/local/Apache/bin/apachectl restart
Restart Apache every hour between PM and PM.
0 11 4 * Mon-wed/usr/local/Apache/bin/apachectl restart
Restart Apache on November 4 and every Monday to Wednesday.
0 4 1 Jan */usr/local/Apache/bin/apachectl restart
Restart Apache at on January 1, January 1
Crontab command:
Crontab view, edit, restart, stop, start
Crontab-[L, E] service crond [restart, stop, start]
It is worth noting that when calling commands regularly in crontab, if the command is not in the classpath of crontab, the full path should be included.
For example, MySQL should be written as/usr/local/MySQL/bin/MySQL
Blog references http://www.blogjava.net/xiaomage234/archive/2007/12/26/170490.html