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
|
|
|
|
[ ! -f /run/nginx.pid.oldbin ] && sleep 5
|
|
|
|
if [ ! -f /run/nginx.pid.oldbin ]; then
|
|
|
|
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`
|
|
|
|
/bin/kill -s QUIT $oldpid 2>/dev/null
|