2014-10-05 12:46:22 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Start/stop nginx
|
|
|
|
#
|
|
|
|
|
2017-09-25 15:20:29 +02:00
|
|
|
NGINX=/usr/sbin/nginx
|
2014-10-05 12:46:22 +02:00
|
|
|
PIDFILE=/var/run/nginx.pid
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
echo "Starting nginx..."
|
|
|
|
mkdir -p /var/log/nginx /var/tmp/nginx
|
2017-09-25 15:20:29 +02:00
|
|
|
start-stop-daemon -S -x "$NGINX" -p "$PIDFILE"
|
2014-10-05 12:46:22 +02:00
|
|
|
;;
|
|
|
|
stop)
|
2017-09-25 15:20:29 +02:00
|
|
|
echo "Stopping nginx..."
|
2017-10-09 11:50:49 +02:00
|
|
|
start-stop-daemon -K -x "$NGINX" -p "$PIDFILE" -o
|
2014-10-05 12:46:22 +02:00
|
|
|
;;
|
2017-09-25 15:20:29 +02:00
|
|
|
reload|force-reload)
|
|
|
|
echo "Reloading nginx configuration..."
|
|
|
|
"$NGINX" -s reload
|
|
|
|
;;
|
|
|
|
restart)
|
2014-10-05 12:46:22 +02:00
|
|
|
"$0" stop
|
2017-10-09 11:50:49 +02:00
|
|
|
sleep 1 # Prevent race condition: ensure nginx stops before start.
|
2014-10-05 12:46:22 +02:00
|
|
|
"$0" start
|
|
|
|
;;
|
|
|
|
*)
|
2017-09-25 15:20:29 +02:00
|
|
|
echo "Usage: $0 {start|stop|restart|reload|force-reload}"
|
2014-10-05 12:46:22 +02:00
|
|
|
exit 1
|
|
|
|
esac
|