wok view nginx/stuff/etc/init.d/nginx @ rev 24768
libwebkit: bison 3 fix
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Mar 19 12:46:44 2022 +0000 (2022-03-19) |
parents | bc2cb6189827 |
children | 3d13c41224cd |
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 _ '%s is already running.' $NAME
19 exit 1
20 fi
21 action 'Starting %s: %s...' "$DESC" $NAME
22 $DAEMON $OPTIONS
23 status
24 ;;
25 stop)
26 if ! active_pidfile $PIDFILE nginx ; then
27 _ '%s is not running.' $NAME
28 exit 1
29 fi
30 action 'Stopping %s: %s...' "$DESC" $NAME
31 kill $(cat $PIDFILE)
32 rm $PIDFILE
33 status
34 ;;
35 restart)
36 if ! active_pidfile $PIDFILE nginx ; then
37 _ '%s is not running.' $NAME
38 exit 1
39 fi
40 action 'Restarting %s: %s...' "$DESC" $NAME
41 kill $(cat $PIDFILE)
42 rm $PIDFILE
43 sleep 2
44 $DAEMON $OPTIONS
45 status
46 ;;
47 *)
48 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
49 newline
50 exit 1
51 ;;
52 esac
54 exit 0