Update fzf location
[dotfiles] / nginx_init_script
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 # /etc/init.d/nginx
14 # chmod 755 /etc/init.d/nginx
15 # update-rc.d nginx default
16
17 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18 DAEMON=/usr/sbin/nginx
19 NAME=nginx
20 DESC=nginx
21
22 test -x $DAEMON || exit 0
23
24 # Include nginx defaults if available
25 if [ -f /etc/default/nginx ] ; then
26 . /etc/default/nginx
27 fi
28
29 set -e
30
31 . /lib/lsb/init-functions
32
33 case "$1" in
34 start)
35 echo -n "Starting $DESC: "
36 start-stop-daemon --start --quiet --pidfile /run/nginx.pid \
37 --exec $DAEMON -- $DAEMON_OPTS || true
38 echo "$NAME."
39 ;;
40 stop)
41 echo -n "Stopping $DESC: "
42 start-stop-daemon --stop --quiet --pidfile /run/nginx.pid \
43 --exec $DAEMON || true
44 echo "$NAME."
45 ;;
46 restart|force-reload)
47 echo -n "Restarting $DESC: "
48 start-stop-daemon --stop --quiet --pidfile \
49 /run/nginx.pid --exec $DAEMON || true
50 sleep 1
51 start-stop-daemon --start --quiet --pidfile \
52 /run/nginx.pid --exec $DAEMON -- $DAEMON_OPTS || true
53 echo "$NAME."
54 ;;
55 reload)
56 echo -n "Reloading $DESC configuration: "
57 start-stop-daemon --stop --signal HUP --quiet --pidfile /run/nginx.pid \
58 --exec $DAEMON || true
59 echo "$NAME."
60 ;;
61 status)
62 status_of_proc -p /run/nginx.pid "$DAEMON" nginx && exit 0 || exit $?
63 ;;
64 *)
65 N=/etc/init.d/$NAME
66 echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2
67 exit 1
68 ;;
69 esac
70
71 exit 0