wok annotate portmap/stuff/init.d/portmap @ 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 1b6281d68d9f
children
rev   line source
erjo@171 1 #!/bin/sh
erjo@171 2 # /etc/init.d/portmap : Start, stop and restart RPC portmapper on SliTaz, at
erjo@171 3 # boot time or with the command line.
erjo@171 4 #
erjo@171 5 # To start RPC portmapper at boot time, just put dropbear in the $RUN_DAEMONS
erjo@171 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
erjo@171 7 #
erjo@171 8 . /etc/init.d/rc.functions
erjo@171 9 . /etc/daemons.conf
erjo@171 10
erjo@171 11 NAME=portmap
al@19159 12 DESC="$(_ 'RPC portmapper')"
erjo@171 13 DAEMON=/usr/sbin/portmap
erjo@171 14 OPTIONS=
erjo@171 15 PIDFILE=/var/run/$NAME.pid
erjo@171 16
erjo@171 17
erjo@171 18 test -f $DAEMON || exit 0
erjo@171 19
erjo@171 20 case "$1" in
al@19159 21 start)
al@19159 22 if active_pidfile $PIDFILE portmap ; then
al@19159 23 _ '%s is already running.' $NAME
al@19159 24 exit 1
al@19159 25 fi
erjo@171 26
al@19159 27 action 'Starting %s: %s...' "$DESC" $NAME
al@19159 28 $DAEMON $OPTIONS
erjo@171 29
al@19159 30 # registering PID
al@19159 31 if [ $? -eq 0 ]; then
al@19159 32 pidof -s $NAME > $PIDFILE
al@19159 33 fi
al@19159 34 status
al@19159 35
al@19159 36 if [ -f /var/run/portmap.upgrade-state ]; then
al@19159 37 action 'Restoring old RPC service information...'
al@19159 38 sleep 1 # needs a short pause or pmap_set won't work. :(
al@19159 39 pmap_set </var/run/portmap.upgrade-state
al@19159 40 rm -f /var/run/portmap.upgrade-state
al@19159 41 status
al@19159 42 fi
al@19159 43 ;;
al@19159 44 stop)
al@19159 45 if ! active_pidfile $PIDFILE portmap ; then
al@19159 46 _ '%s is not running.' $NAME
al@19159 47 exit 1
al@19159 48 fi
al@19159 49 action 'Stopping %s: %s...' "$DESC" $NAME
al@19159 50 kill $(cat $PIDFILE)
al@19159 51 rm -f $PIDFILE
al@19159 52 status
al@19159 53 ;;
al@19159 54 restart)
al@19159 55 pmap_dump >/var/run/portmap.state
al@19159 56 $0 stop
al@19159 57 $0 start
al@19159 58 if [ ! -f /var/run/portmap.upgrade-state ]; then
al@19159 59 sleep 1
al@19159 60 pmap_set </var/run/portmap.state
al@19159 61 fi
al@19159 62 rm -f /var/run/portmap.state
al@19159 63 ;;
al@19159 64 *)
al@19159 65 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
al@19159 66 newline
al@19159 67 exit 1
al@19159 68 ;;
erjo@171 69 esac
erjo@171 70
erjo@171 71 exit 0