Bugs solved in Nginx starting scripts
This commit is contained in:
parent
4a388f241c
commit
d1096a270f
|
@ -1,8 +1,8 @@
|
|||
@echo off
|
||||
|
||||
set currentDir=%cd%
|
||||
set nginxPrefix=%currentDir%\services\nginx
|
||||
set nginxConf=%nginxPrefix%\temp\nginx.conf
|
||||
set nginxDir=%~dp0
|
||||
set nginxTemp=%nginxDir%\temp
|
||||
set nginxConf=%nginxTemp%\nginx.conf
|
||||
|
||||
if "%1"=="" goto caseStart
|
||||
if "%1"=="start" goto caseStart
|
||||
|
@ -12,13 +12,13 @@ goto caseUsage
|
|||
:caseStart
|
||||
call "%0" stop
|
||||
echo Starting nginx.
|
||||
if not exist "%nginxPrefix%\temp" (mkdir "%nginxPrefix%\temp")
|
||||
start /I nginx -c "%nginxConf%" -p "%nginxPrefix%"
|
||||
if not exist "%nginxTemp%" (mkdir "%nginxTemp%")
|
||||
start /I nginx -c "%nginxConf%" -p "%nginxDir%"
|
||||
goto caseEnd
|
||||
|
||||
:caseStop
|
||||
echo Stoping nginx.
|
||||
if exist "%nginxPrefix%\temp\nginx.pid" (nginx -c "%nginxConf%" -p "%nginxPrefix%" -s stop)
|
||||
if exist "%nginxTemp%\nginx.pid" (nginx -c "%nginxConf%" -p "%nginxDir%" -s stop)
|
||||
goto caseEnd
|
||||
|
||||
:caseUsage
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
nginxDir="$(dirname $0)"
|
||||
nginxTemp="$nginxDir/temp"
|
||||
nginxConf="temp/nginx.conf"
|
||||
nginxBin="/usr/sbin/nginx"
|
||||
nginxPrefix="${PWD}/services/nginx"
|
||||
nginxConf="$nginxPrefix/temp/nginx.conf"
|
||||
|
||||
if [ ! -f $nginxBin ]; then
|
||||
nginxBin="nginx"
|
||||
fi
|
||||
|
||||
echo $nginxConf $nginxDir
|
||||
case "$1" in
|
||||
start|"")
|
||||
$0 stop
|
||||
echo "Starting nginx."
|
||||
mkdir -p "$nginxPrefix/temp"
|
||||
"$nginxBin" -c "$nginxConf" -p "$nginxPrefix" 2>> /dev/null
|
||||
mkdir -p "$nginxTemp"
|
||||
"$nginxBin" -c "$nginxConf" -p "$nginxDir"
|
||||
;;
|
||||
stop)
|
||||
echo "Stoping nginx."
|
||||
"$nginxBin" -c "$nginxConf" -p "$nginxPrefix" -s stop 2>> /dev/null
|
||||
if [ -f "$nginxTemp/nginx.pid" ]; then
|
||||
"$nginxBin" -c "$nginxConf" -p "$nginxDir" -s stop
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: `basename "$0"` [start|stop]"
|
||||
|
|
Loading…
Reference in New Issue