wok annotate nginx-extras/stuff/etc/init.d/nginx @ rev 19159

/etc/init.d/*: use 'action' in pair with 'status'.
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu May 26 20:16:45 2016 +0300 (2016-05-26)
parents 4e10d83260c5
children 3d13c41224cd
rev   line source
nneul@18379 1 #!/bin/sh
al@19159 2 # /etc/init.d/nginx: Start, stop and restart web server on SliTaz,
nneul@18379 3 # at boot time or with the command line. Daemons options are configured
nneul@18379 4 # with /etc/daemons.conf
nneul@18379 5 #
nneul@18379 6 . /etc/init.d/rc.functions
nneul@18379 7 . /etc/daemons.conf
nneul@18379 8
nneul@18379 9 NAME=Nginx
al@19159 10 DESC="$(_ 'web server')"
nneul@18379 11 DAEMON=/usr/sbin/nginx
nneul@18379 12 OPTIONS=$NGINX_OPTIONS
nneul@18379 13 PIDFILE=/var/run/nginx.pid
nneul@18379 14
nneul@18379 15 case "$1" in
nneul@18379 16 start)
nneul@18379 17 if active_pidfile $PIDFILE nginx ; then
al@19159 18 _ '%s is already running.' $NAME
nneul@18379 19 exit 1
nneul@18379 20 fi
al@19159 21 action 'Starting %s: %s...' "$DESC" $NAME
al@19159 22 $DAEMON $OPTIONS
nneul@18379 23 status
nneul@18379 24 ;;
nneul@18379 25 stop)
nneul@18379 26 if ! active_pidfile $PIDFILE nginx ; then
al@19159 27 _ '%s is not running.' $NAME
nneul@18379 28 exit 1
nneul@18379 29 fi
al@19159 30 action 'Stopping %s: %s...' "$DESC" $NAME
al@19159 31 kill $(cat $PIDFILE)
nneul@18379 32 rm $PIDFILE
nneul@18379 33 status
nneul@18379 34 ;;
nneul@18379 35 restart)
nneul@18379 36 if ! active_pidfile $PIDFILE nginx ; then
al@19159 37 _ '%s is not running.' $NAME
nneul@18379 38 exit 1
nneul@18379 39 fi
al@19159 40 action 'Restarting %s: %s...' "$DESC" $NAME
al@19159 41 kill $(cat $PIDFILE)
nneul@18379 42 rm $PIDFILE
nneul@18379 43 sleep 2
nneul@18379 44 $DAEMON $OPTIONS
nneul@18379 45 status
nneul@18379 46 ;;
nneul@18379 47 *)
al@19159 48 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
al@19159 49 newline
nneul@18379 50 exit 1
nneul@18379 51 ;;
nneul@18379 52 esac
nneul@18379 53
nneul@18379 54 exit 0