diff options
author | Jinwei Zhao <[email protected]> | 2016-11-14 22:25:30 +0800 |
---|---|---|
committer | Jinwei Zhao <[email protected]> | 2016-11-14 22:25:30 +0800 |
commit | 46fac791df153c437aa182896366c9d45c012404 (patch) | |
tree | 7c2e626336f6837567dd4c363640056ccdd8b171 /nginx.service | |
parent | 380ab77b485c1e7fe8d7546ddfec9d2252b15c11 (diff) | |
download | nginx-proxy-google-46fac791df153c437aa182896366c9d45c012404.tar.gz |
nginx-proxy-google
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 | ||