Windows implementation timed restart Apache and MySQL method _linux

Source: Internet
Author: User
Tags mssqlserver time interval

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:

Copy Code code as follows:

@ECHO off
net stop Apache2
net start apache2
net stop MySQL
net start MySQL

Description: Above the apache2 with MySQL for the service name.

2, "Start"-"Run" cmd "-" Execute Command "at 04:00 C:\autostartserver.bat"
That way, the system automatically restarts Apache and MySQL 4 o'clock in the morning every day.
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 implemented through the following code.
Copy Code code 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 above is an interval of 50 seconds (50000 milliseconds) to start the SQL Server service, because SQL Server shutdown and startup requires a certain amount of time, MySQL does not need a time interval.

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.