The server does not restart the case of scheduled automatic restart Apache and MySQL services, in fact, the same. The steps are as follows:
I. Restart Apache and MySQL services at 12 and 16 points per day
[Email protected] bin]# cd/opt/
[Email protected] opt]# vim Reboot.txt
After entering the following in the Reboot.txt.txt file, save 0 12 * *
Service httpd Restart 0 12 * * *
Service mysqld Restart 0 16 * * *
Service httpd Restart 0 16 * * *
Service mysqld Restart
Second, add the new file to the Cron service
[Email protected] opt]# crontab reboot.txt
[[email protected] opt]# CRONTAB-L 0 12 * * *
Service httpd Restart 0 12 * * *
Service mysqld Restart 0 16 * * *
Service httpd Restart 0 16 * * *
Service mysqld Restart
Third, restart the cron service
[Email protected] opt]#/sbin/service crond restart
=======================================
Additional notes:
Cron is a timed execution tool under Linux that can run a job without human intervention.
Since Cron is a built-in service for Linux, it does not automatically get up, and you can start and shut down this service in the following ways:
/sbin/service Crond Start//Startup service
/sbin/service Crond stop//Shut down service
/sbin/service crond Restart//Restart service
/sbin/service Crond Reload//Reload Configuration
The basic format of the schedule table:
* * * * * * Program time-sharing 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
When the 1th column indicates that the program is to be executed every minute, the 2nd column indicates that it executes every hour, and the rest of the analogy
When the 1th column is a A-B, it is to be executed from the minute of a to a minute, and the 2nd column A-B indicates that it is to be executed from the first and the other, and the other analogy
When the 1th column is */n, it is executed once every n minutes, and the 2nd column */n indicates that every n-hour interval is executed once, and the rest of the analogy
When the 1th column is a, B, C,... A, B, C,... Minutes to execute, 2nd column A, B, C,... The time indicated that the first, B, c ... Hours to execute, and the rest of the analogy crontab files are some examples:
* * * * * */USR/LOCAL/ETC/RC.D/LIGHTTPD Restart the above example indicates a 21:30 restart lighttpd per night.
4 1,10,22 * */USR/LOCAL/ETC/RC.D/LIGHTTPD Restart the above example shows 4:45 restart lighttpd per month for 1, 10, 22nd.
1 * * 6,0/USR/LOCAL/ETC/RC.D/LIGHTTPD Restart the above example shows the 1:10 restart lighttpd per Saturday and Sunday.
0,30 18-23 * * */usr/local/etc/rc.d/lighttpd restart
The example above shows that LIGHTTPD 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 LIGHTTPD is restarted every Saturday.
* */1 * * * */usr/local/etc/rc.d/lighttpd Restart restart every hour lighttpd
* 23-7/1 * * * */usr/local/etc/rc.d/lighttpd restart from 11 o'clock to 7 in the morning and restarts every hour lighttpd
0 4 * mon-wed/usr/local/etc/rc.d/lighttpd restart 4th per month and 11-point restart from Monday to Wednesday lighttpd
0 4 1 Jan */usr/local/etc/rc.d/lighttpd restart January 1 4-point restart LIGHTTPD
If you need to restart the server, add a line of 0 * * * Root init 6
Reprinted from: Http://wenku.baidu.com/link?url=j_ jk0ghthfge9mofeouti-pnclqgiwyxo2qdwf3rgeqf1we9fkm8nls2elkbw4tftmgl0cebfo36z3c9lsnlrc2oavkpebihqtgj4cjsk5u
Server timing program settings in Linux