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