Use the AT command to add a scheduled task. For the syntax, Run "cmd"-"execute the command" at/"in" window-"start"-"to display the AT command syntax. The following describes how to enable the server to regularly start Apache and MYSQL:
1. Create an autostartserver. BAT file in the C: root directory, right-click it, set the file content to the following, and save it:CopyCodeThe Code is as follows: @ echo off
Net stop apache2
Net start apache2
Net stop MySQL
Net start MySQL
Note: The above apache2 and MySQL are service names.
2. "Start"-"run" cmd "-" run the command "at c: \ autostartserver. Bat"
In this way, the system automatically restarts Apache and MySQL at every morning.
Note: 04: 00 indicates the restart time, and c: \ autostartserver. Bat indicates the BAT file address in step 1.
Sometimes there is a certain interval in the middle, which can be implemented through 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