2012-05-16 21:11:49 +00:00
|
|
|
#!/bin/sh
|
|
|
|
[ ! -f /run/nginx.pid ] && exit 1
|
|
|
|
echo "Start new nginx master..."
|
2012-12-18 10:56:20 +00:00
|
|
|
/bin/systemctl kill --signal=SIGUSR2 nginx.service
|
2012-05-16 21:11:49 +00:00
|
|
|
sleep 5
|
2015-04-22 14:22:51 +00:00
|
|
|
[ ! -f /run/nginx.pid.oldbin ] && sleep 10
|
2012-05-16 21:11:49 +00:00
|
|
|
if [ ! -f /run/nginx.pid.oldbin ]; then
|
2015-04-22 14:22:51 +00:00
|
|
|
echo "Failed to start new nginx master."
|
|
|
|
exit 1
|
2012-05-16 21:11:49 +00:00
|
|
|
fi
|
|
|
|
echo "Stop old nginx master gracefully..."
|
2015-04-22 14:22:51 +00:00
|
|
|
oldpid=`/usr/bin/cat /run/nginx.pid.oldbin 2>/dev/null`
|
2012-05-16 21:11:49 +00:00
|
|
|
/bin/kill -s QUIT $oldpid 2>/dev/null
|
2015-04-22 14:22:51 +00:00
|
|
|
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
|