Sometimes for servers with better efficiency, you can restart Apache services on a timed basis. Make the site run faster.
Add a scheduled task with the AT command. For the use of syntax can go to window-"Start"-"Run" cmd "-" execute Command "at/", so that the interface will display the syntax of the AT command. Below we explain how to get the server to start Apache and MySQL on time:
1, in the C: Packing directory to create a new Autostartserver.bat file, and then right-click Edit, the file content is set as follows to save:
Copy CodeThe code is as follows:
@ECHO OFF
net stop Apache2
net start apache2
net stop MySQL
net start MySQL
Description: The above apache2 with MySQL for the service name.
2, "Start"-"Run" cmd "-" Execute Command "at 04:00 C:\autostartserver.bat"
This way, the system automatically restarts Apache and MySQL every 4 o'clock in the morning.
Description: 04:00 Restart time, C:\autostartserver.bat is the first step of the bat file address
Sometimes the middle requires a certain interval, can be implemented by the following code.
Copy CodeThe code is as follows:
net stop SQLServerAgent
net stop MSSQLSERVER
Echo.wscript.sleep (50000) >s.vbs
cscript//nologo S.vbs
Del S.vbs
NET start MSSQLServer
Net start SQLServerAgent
The SQL Server service starts at a interval of 50 seconds (50000 milliseconds), because SQL Server shuts down and starts at a certain time, and MySQL does not require a time interval.
Implement timed restart Apache and MySQL method under Windows