Windows implementation timed restart Apache and MySQL and MSSQLServer method

Source: Internet
Author: User
Tags .net apache apache2 create directory file get how to
Sometimes for the server to have better efficiency, you can periodically restart the Apache service. Make the Web site run faster. Add a scheduled task with the AT command. For the use of syntax you can go to window-"Start"-"Run" cmd "-" execute Command "at/" so that the interface will show the syntax of the AT command. Let's explain how to get the server to start Apache and MySQL regularly:

1, in the C: the directory to create a new Autostartserver.bat file, and then right-click Edit, the contents of the file set to save as follows:
@ECHO off
net stop Apache2
net start apache2
net stop MySQL
net start MySQL

Description: Above apache2 with MySQL for service name.

2, "Start"-"Run" cmd "-" Execute Command "at 04:00 C:autostartserver.bat"
So every 4 o'clock in the morning the system automatically restarts Apache and MySQL.
Description: 04:00 Restart time, c:autostartserver.bat as the first step of the bat file address

Sometimes the middle requires a certain interval of time, can be achieved through the following code.
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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.