Batch code handle Windows nginx+php (FastCGI) Management _dos/bat

Source: Internet
Author: User
Tags goto
Note the value of several variables under the start of the change
Program code
Copy Code code as follows:

SET Nginx_path=d:
SET nginx_dir=d:\nginx-0.7.63\
SET php_dir=d:\php\
++++++++++++++++++ Code starts ++++++++++++++++
Cls
@ECHO off
SET Nginx_path=d:
SET nginx_dir=d:\nginx-0.7.63\
SET php_dir=d:\php\
Color 0a
TITLE nginx+php Management Program (niming http://www.link888.cn)
GOTO MENU
: MENU
Cls
ECHO.
ECHO. * * * * * * * * nginx+php Management PROCEDURE * * * * * * *
ECHO. * *
ECHO. * 1 Start Nginx *
ECHO. * *
ECHO. * 2 off Nginx *
ECHO. * *
ECHO. * 3 Reboot Nginx *
ECHO. * *
ECHO. * 4 Start php-cgi *
ECHO. * *
ECHO. * 5 off php-cgi *
ECHO. * *
ECHO. * 6 Reboot php-cgi *
ECHO. * *
ECHO. * 7 Exit *
ECHO. * *
ECHO. * * * * * * * * * * * * * * * * * * * * * * * *
ECHO.
ECHO. Please enter the serial number of the selected item:
set/p id=
IF "%id%" = = "1" GOTO cmd1
IF "%id%" = = "2" GOTO cmd2
IF "%id%" = = "3" GOTO cmd3
IF "%id%" = = "4" GOTO CMD4
IF "%id%" = = "5" GOTO cmd5
IF "%id%" = = "6" GOTO Cmd6
IF "%id%" = "7" EXIT
PAUSE
: cmd1
ECHO.
ECHO, start Nginx ...
IF not EXIST%nginx_dir%nginx.exe ECHO%nginx_dir%nginx.exe does not exist
%nginx_path%
CD%nginx_dir%
IF EXIST%nginx_dir%nginx.exe Start%nginx_dir%nginx.exe
ECHO. Ok
PAUSE
GOTO MENU
: CMD2
ECHO.
ECHO, close nginx ...
taskkill/f/im nginx.exe > nul
ECHO. Ok
PAUSE
GOTO MENU
: Cmd3
ECHO.
ECHO, close nginx ...
taskkill/f/im nginx.exe > nul
ECHO. Ok
GOTO cmd1
GOTO MENU
: CMD4
ECHO.
ECHO, start php-cgi ...
IF not EXIST%php_dir%php-cgi.exe ECHO%php_dir%php-cgi.exe does not exist
echo Set wscriptobj = CreateObject ("Wscript.Shell") >start_fastcgi.vbs
echo Wscriptobj.run "%php_dir%php-cgi.exe-b 127.0.0.1:9000", 0 >>start_fastcgi.vbs
Start_fastcgi.vbs
Del Start_fastcgi.vbs
ECHO. Ok
PAUSE
GOTO MENU
: CMD5
ECHO.
ECHO, close php-cgi ...
taskkill/f/im php-cgi.exe > nul
ECHO. Ok
PAUSE
GOTO MENU
: Cmd6
ECHO.
ECHO, close php-cgi ...
taskkill/f/im php-cgi.exe > nul
ECHO. Ok
GOTO CMD4
GOTO MENU

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.