blob: 1a2bd7dff51d29a90b164005b5fb6aabdcef7b08 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001#! /bin/sh
2PATH=/sbin:/bin:/usr/sbin:/usr/bin
3DAEMON=/usr/sbin/nginx
4NAME=nginx
5DESC=nginx
Brad Bishop6e60e8b2018-02-01 10:27:11 -05006PID=/run/nginx/nginx.pid
Patrick Williamsb48b7b42016-08-17 15:04:38 -05007
8test -x $DAEMON || exit 0
9
10# Include nginx defaults if available
11if [ -f /etc/default/nginx ] ; then
12 . /etc/default/nginx
13fi
14
15set -e
16
17case "$1" in
18 start)
19 echo -n "Starting $DESC: "
20 start-stop-daemon --start --quiet --pidfile $PID \
21 --name $NAME --exec $DAEMON -- $DAEMON_OPTS
22 echo "$NAME."
23 ;;
24 stop)
25 echo -n "Stopping $DESC: "
26 start-stop-daemon -K --quiet --pidfile $PID \
27 --name $NAME
28 echo "$NAME."
29 ;;
30 restart|force-reload)
31 echo -n "Restarting $DESC: "
32 start-stop-daemon -K --quiet --pidfile $PID \
33 --name $NAME
34 sleep 1
35 start-stop-daemon --start --quiet --pidfile $PID \
36 --name $NAME --exec $DAEMON -- $DAEMON_OPTS
37 echo "$NAME."
38 ;;
39 reload)
40 echo -n "Reloading $DESC configuration: "
41 start-stop-daemon --stop --signal HUP --quiet --pidfile $PID \
42 --exec $DAEMON
43 echo "$NAME."
44 ;;
45 *)
46 N=/etc/init.d/$NAME
47 echo "Usage: $N {start|stop|restart|force-reload}" >&2
48 exit 1
49 ;;
50esac
51
52exit 0