mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-26 20:56:33 +00:00
nginx (S50nginx): Fix stop, reload, restart. Add force-reload.
Fix package/nginx/S50nginx: * On stop, use start-stop-daemon -R 1 to wait for the nginx processes to actually stop. This fixes a race condition with restart, where nginx fails to restart because start is called too early w.r.t. stop. (This only works with Debian's start-stop-daemon, however BusyBox's start-stop-daemon does not fail when given -R; it just ignores the argument silently). * Implement reload with an actual reload instead of a restart. * Add force-reload. Signed-off-by: Thomas Claveirole <thomas.claveirole@green-communications.fr> Reviewed-by: Samuel Martin <s.martin49@gmail.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
This commit is contained in:
parent
9f4178ac79
commit
23094a0df9
@ -3,23 +3,31 @@
|
|||||||
# Start/stop nginx
|
# Start/stop nginx
|
||||||
#
|
#
|
||||||
|
|
||||||
|
NGINX=/usr/sbin/nginx
|
||||||
PIDFILE=/var/run/nginx.pid
|
PIDFILE=/var/run/nginx.pid
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
echo "Starting nginx..."
|
echo "Starting nginx..."
|
||||||
mkdir -p /var/log/nginx /var/tmp/nginx
|
mkdir -p /var/log/nginx /var/tmp/nginx
|
||||||
start-stop-daemon -S -x /usr/sbin/nginx -p $PIDFILE
|
start-stop-daemon -S -x "$NGINX" -p "$PIDFILE"
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
printf "Stopping nginx..."
|
echo "Stopping nginx..."
|
||||||
start-stop-daemon -K -o -p $PIDFILE
|
# Use -R 1 to wait for nginx to actually stop. Useful so
|
||||||
|
# restart has no race condition. Note that BusyBox knows
|
||||||
|
# about -R but ignores it silently.
|
||||||
|
start-stop-daemon -K -x "$NGINX" -p "$PIDFILE" -R 1 -o
|
||||||
;;
|
;;
|
||||||
restart|reload)
|
reload|force-reload)
|
||||||
|
echo "Reloading nginx configuration..."
|
||||||
|
"$NGINX" -s reload
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
"$0" stop
|
"$0" stop
|
||||||
"$0" start
|
"$0" start
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {start|stop|restart}"
|
echo "Usage: $0 {start|stop|restart|reload|force-reload}"
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user