diff options
Diffstat (limited to 'nginx.service')
-rw-r--r-- | nginx.service | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/nginx.service b/nginx.service new file mode 100644 index 0000000..7714aac --- /dev/null +++ b/nginx.service | |||
@@ -0,0 +1,62 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | ### BEGIN INIT INFO | ||
4 | # Provides: nginx | ||
5 | # Required-Start: $all | ||
6 | # Required-Stop: $all | ||
7 | # Default-Start: 2 3 4 5 | ||
8 | # Default-Stop: 0 1 6 | ||
9 | # Short-Description: starts the nginx web server | ||
10 | # Description: starts nginx using start-stop-daemon | ||
11 | ### END INIT INFO | ||
12 | |||
13 | PATH=/opt/nginx/sbin:/sbin:/bin:/usr/sbin:/usr/bin | ||
14 | DAEMON=/usr/sbin/nginx | ||
15 | NAME=nginx | ||
16 | DESC=nginx | ||
17 | |||
18 | test -x $DAEMON || exit 0 | ||
19 | |||
20 | # Include nginx defaults if available | ||
21 | if [ -f /etc/default/nginx ] ; then | ||
22 | . /etc/default/nginx | ||
23 | fi | ||
24 | |||
25 | set -e | ||
26 | |||
27 | case "$1" in | ||
28 | start) | ||
29 | echo -n "Starting $DESC: " | ||
30 | start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ | ||
31 | --exec $DAEMON -- $DAEMON_OPTS | ||
32 | echo "$NAME." | ||
33 | ;; | ||
34 | stop) | ||
35 | echo -n "Stopping $DESC: " | ||
36 | start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ | ||
37 | --exec $DAEMON | ||
38 | echo "$NAME." | ||
39 | ;; | ||
40 | restart|force-reload) | ||
41 | echo -n "Restarting $DESC: " | ||
42 | start-stop-daemon --stop --quiet --pidfile \ | ||
43 | /var/run/$NAME.pid --exec $DAEMON | ||
44 | sleep 1 | ||
45 | start-stop-daemon --start --quiet --pidfile \ | ||
46 | /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS | ||
47 | echo "$NAME." | ||
48 | ;; | ||
49 | reload) | ||
50 | echo -n "Reloading $DESC configuration: " | ||
51 | start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \ | ||
52 | --exec $DAEMON | ||
53 | echo "$NAME." | ||
54 | ;; | ||
55 | *) | ||
56 | N=/etc/init.d/$NAME | ||
57 | echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 | ||
58 | exit 1 | ||
59 | ;; | ||
60 | esac | ||
61 | |||
62 | exit 0 \ No newline at end of file | ||