From d86a02dac373c9d3eacefa075b1a0aba26e2deef Mon Sep 17 00:00:00 2001 From: Jamie Nguyen Date: Wed, 22 Apr 2015 15:22:51 +0100 Subject: [PATCH] Extend sleep times and add additional check --- nginx-upgrade | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/nginx-upgrade b/nginx-upgrade index 70f71e5..f84d91a 100644 --- a/nginx-upgrade +++ b/nginx-upgrade @@ -3,11 +3,17 @@ echo "Start new nginx master..." /bin/systemctl kill --signal=SIGUSR2 nginx.service sleep 5 -[ ! -f /run/nginx.pid.oldbin ] && sleep 5 +[ ! -f /run/nginx.pid.oldbin ] && sleep 10 if [ ! -f /run/nginx.pid.oldbin ]; then - echo "Failed to start new nginx master." - exit 1 + echo "Failed to start new nginx master." + exit 1 fi 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 +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