wok-next view nginx/stuff/etc/init.d/nginx @ rev 17337
Up slitaz-tools slitaz-tools-boxes (5.8.11)
author | Xander Ziiryanoff <psychomaniak@xakep.ru> |
---|---|
date | Wed Nov 05 18:12:18 2014 +0100 (2014-11-05) |
parents | |
children | 7f188676b59c |
line source
1 #!/bin/sh
2 # /etc/init.d/nginx: Start, stop and restart web server on SliTaz,
3 # at boot time or with the command line. Daemons options are configured
4 # with /etc/daemons.conf
5 #
6 . /etc/init.d/rc.functions
7 . /etc/daemons.conf
9 NAME=Nginx
10 DESC="web server"
11 DAEMON=/usr/sbin/nginx
12 OPTIONS=$NGINX_OPTIONS
13 PIDFILE=/var/run/nginx.pid
15 case "$1" in
16 start)
17 if active_pidfile $PIDFILE nginx ; then
18 echo "$NAME already running."
19 exit 1
20 fi
21 echo -n "Starting $DESC: $NAME... "
22 $DAEMON $OPTIONS
23 status
24 ;;
25 stop)
26 if ! active_pidfile $PIDFILE nginx ; then
27 echo "$NAME is not running."
28 exit 1
29 fi
30 echo -n "Stopping $DESC: $NAME... "
31 kill `cat $PIDFILE`
32 rm $PIDFILE
33 status
34 ;;
35 restart)
36 if ! active_pidfile $PIDFILE nginx ; then
37 echo "$NAME is not running."
38 exit 1
39 fi
40 echo -n "Restarting $DESC: $NAME... "
41 kill `cat $PIDFILE`
42 rm $PIDFILE
43 sleep 2
44 $DAEMON $OPTIONS
45 status
46 ;;
47 *)
48 echo ""
49 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
50 echo ""
51 exit 1
52 ;;
53 esac
55 exit 0