@echo off
rem 设置环境变量
set run_hidden_console_home=d:/lxfamn/wnmp
set php_home=d:/lxfamn/wnmp/php8
set nginx_home=d:/lxfamn/wnmp/nginx
rem 重启MySQL
SET status=1
(TASKLIST|FIND /I "mysqld"||SET status=0) 2>nul 1>nul
IF %status% EQU 1 (
net stop "mariadb"
echo mariadb已停止
) ELSE (
echo MySQL未启动,不需停止
)
net start "mariadb"
rem 重启PHP FastCGI
(TASKLIST|FIND /I "php-cgi.exe"||SET status=0) 2>nul 1>nul
IF %status% EQU 1 (
taskkill /F /IM php-cgi.exe > nul
echo PHP FastCGI已停止
) ELSE (
echo PHP FastCGI未启动,不需停止
)
%run_hidden_console_home%/RunHiddenConsole.exe %php_home%/php-cgi.exe -b 127.0.0.1:9000 -c %php_home%/php.ini-production
echo PHP FastCGI启动成功
rem 重启nginx
echo,
SET status=1
(TASKLIST|FIND /I "nginx.exe"||SET status=0) 2>nul 1>nul
IF %status% EQU 1 (
taskkill /F /IM nginx.exe > nul
echo Nginx已停止
) ELSE (
echo Nginx未启动,不需停止
)
%run_hidden_console_home%/RunHiddenConsole.exe %nginx_home%/nginx.exe -p %nginx_home%
echo Nginx启动成功
echo,
echo 按任意键退出界面(程序依然在运行)
pause>nul
exit
启动脚本
@echo off
set run_hidden_console_home=d:/lxfamn/wnmp
set php_home=d:/lxfamn/wnmp/php8
set nginx_home=d:/lxfamn/wnmp/nginx
rem 启动MySQL
SET status=1
(TASKLIST|FIND /I "mysqld.exe"||SET status=0) 2>nul 1>nul
IF %status% EQU 1 (
echo MySQL已经启动过了
) ELSE (
net start "mariadb"
)
rem 启动PHP FastCGI
(TASKLIST|FIND /I "php-cgi.exe"||SET status=0) 2>nul 1>nul
IF %status% EQU 1 (
echo PHP FastCGI已经启动过了
) ELSE (
%run_hidden_console_home%/RunHiddenConsole.exe %php_home%/php-cgi.exe -b 127.0.0.1:9000 -c %php_home%/php.ini
echo PHP FastCGI启动成功
)
rem 启动nginx
echo,
SET status=1
(TASKLIST|FIND /I "nginx.exe"||SET status=0) 2>nul 1>nul
IF %status% EQU 1 (
echo Nginx已经启动过了
) ELSE (
%run_hidden_console_home%/RunHiddenConsole.exe %nginx_home%/nginx.exe -p %nginx_home%
echo Nginx启动成功
)
echo,
echo 按任意键退出界面(程序依然在运行)
pause>nul
exit
停止:
@echo off
net stop mysql
taskkill /F /IM php-cgi.exe > nul
echo PHP FastCGI已停止
taskkill /F /IM nginx.exe > nul
echo Nginx已停止
echo,
echo 按任意键退出
pause>nul
exit
转载请注明出处:
未经允许不得转载:lxfamn » wnmp mariadb nginx php 重启 bat 脚本