wok diff unfs3/stuff/etc/init.d/unfsd @ 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 diff
     1.1 --- a/unfs3/stuff/etc/init.d/unfsd	Fri Sep 10 16:25:17 2010 +0200
     1.2 +++ b/unfs3/stuff/etc/init.d/unfsd	Thu May 26 20:16:45 2016 +0300
     1.3 @@ -9,7 +9,7 @@
     1.4  . /etc/daemons.conf
     1.5  
     1.6  NAME=unfsd
     1.7 -DESC="NFSv3 Server"
     1.8 +DESC="$(_ '%s server' NFSv3)"
     1.9  DAEMON=/usr/bin/unfsd
    1.10  OPTIONS=
    1.11  PIDFILE=/var/run/$NAME.pid
    1.12 @@ -18,40 +18,40 @@
    1.13  test -f $DAEMON || exit 0
    1.14  
    1.15  case "$1" in
    1.16 -    start)
    1.17 -	if active_pidfile $PIDFILE unfsd ; then
    1.18 -      		echo "$NAME already running."
    1.19 -      		exit 1
    1.20 -    	fi
    1.21 +  start)
    1.22 +    if active_pidfile $PIDFILE unfsd ; then
    1.23 +      _ '%s is already running.' $NAME
    1.24 +      exit 1
    1.25 +    fi
    1.26  
    1.27 -    	echo -n "Starting $DESC: $NAME... "
    1.28 -    	$DAEMON $OPTIONS
    1.29 -    	status
    1.30 -    	
    1.31 -    	# registering PID
    1.32 -    	if [ $? -eq 0 ]; then
    1.33 -   		pidof -s $NAME > $PIDFILE
    1.34 -    	fi
    1.35 -	;;
    1.36 -    stop)
    1.37 -	if ! active_pidfile $PIDFILE unfsd ; then
    1.38 -           echo "$NAME is not running."
    1.39 -           exit 1
    1.40 -        fi
    1.41 -        echo -n "Stopping $DESC: $NAME... "
    1.42 -        kill `cat $PIDFILE`
    1.43 -        rm -f $PIDFILE
    1.44 -        status
    1.45 -	;;
    1.46 -    restart)
    1.47 -        $0 stop
    1.48 -        $0 start
    1.49 -	;;
    1.50 -    *)
    1.51 -		echo "Usage: $DAEMON {start|stop|reload|restart}"
    1.52 -		exit 1
    1.53 -	;;
    1.54 +    action 'Starting %s: %s...' "$DESC" $NAME
    1.55 +    $DAEMON $OPTIONS
    1.56 +    status
    1.57 +
    1.58 +    # registering PID
    1.59 +    if [ $? -eq 0 ]; then
    1.60 +      pidof -s $NAME > $PIDFILE
    1.61 +    fi
    1.62 +    ;;
    1.63 +  stop)
    1.64 +    if ! active_pidfile $PIDFILE unfsd ; then
    1.65 +      _ '%s is not running.' $NAME
    1.66 +      exit 1
    1.67 +    fi
    1.68 +    action 'Stopping %s: %s...' "$DESC" $NAME
    1.69 +    kill $(cat $PIDFILE)
    1.70 +    rm -f $PIDFILE
    1.71 +    status
    1.72 +    ;;
    1.73 +  restart)
    1.74 +    $0 stop
    1.75 +    $0 start
    1.76 +    ;;
    1.77 +  *)
    1.78 +    emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
    1.79 +    newline
    1.80 +    exit 1
    1.81 +    ;;
    1.82  esac
    1.83  
    1.84  exit 0
    1.85 -