Extend sleep times and add additional check

This commit is contained in:
Jamie Nguyen 2015-04-22 15:22:51 +01:00
parent ed8afe3dd1
commit d86a02dac3

View File

@ -3,11 +3,17 @@
echo "Start new nginx master..." echo "Start new nginx master..."
/bin/systemctl kill --signal=SIGUSR2 nginx.service /bin/systemctl kill --signal=SIGUSR2 nginx.service
sleep 5 sleep 5
[ ! -f /run/nginx.pid.oldbin ] && sleep 5 [ ! -f /run/nginx.pid.oldbin ] && sleep 10
if [ ! -f /run/nginx.pid.oldbin ]; then if [ ! -f /run/nginx.pid.oldbin ]; then
echo "Failed to start new nginx master." echo "Failed to start new nginx master."
exit 1 exit 1
fi fi
echo "Stop old nginx master gracefully..." echo "Stop old nginx master gracefully..."
oldpid=`cat /run/nginx.pid.oldbin 2>/dev/null` oldpid=`/usr/bin/cat /run/nginx.pid.oldbin 2>/dev/null`
/bin/kill -s QUIT $oldpid 2>/dev/null /bin/kill -s QUIT $oldpid 2>/dev/null
sleep 5
[ -f /run/nginx.pid.oldbin ] && sleep 10
if [ -f /run/nginx.pid.oldbin ]; then
echo "Failed to stop old nginx master."
exit 1
fi