28 lines
573 B
Batchfile
28 lines
573 B
Batchfile
@echo off
|
|
|
|
set nginxDir=%~dp0
|
|
set nginxTemp=%nginxDir%\temp
|
|
set nginxConf=temp\nginx.conf
|
|
|
|
if "%1"=="" goto caseStart
|
|
if "%1"=="start" goto caseStart
|
|
if "%1"=="stop" goto caseStop
|
|
goto caseUsage
|
|
|
|
:caseStart
|
|
call "%0" stop
|
|
echo Starting nginx.
|
|
if not exist "%nginxTemp%" (mkdir "%nginxTemp%")
|
|
start /I nginx -c "%nginxConf%" -p "%nginxDir%"
|
|
goto caseEnd
|
|
|
|
:caseStop
|
|
echo Stoping nginx.
|
|
if exist "%nginxTemp%\nginx.pid" (nginx -c "%nginxConf%" -p "%nginxDir%" -s stop)
|
|
goto caseEnd
|
|
|
|
:caseUsage
|
|
echo "Usage: %0 [start|stop]"
|
|
|
|
:caseEnd
|