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