ignatenkobrain / rpms / nginx

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