Blame SOURCES/nginx-upgrade

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