wok diff backuppc/stuff/etc/init.d/backuppc @ 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 118babc9679f
children
line diff
     1.1 --- a/backuppc/stuff/etc/init.d/backuppc	Wed Mar 16 09:13:12 2011 +0100
     1.2 +++ b/backuppc/stuff/etc/init.d/backuppc	Thu May 26 20:16:45 2016 +0300
     1.3 @@ -9,7 +9,7 @@
     1.4  . /etc/daemons.conf
     1.5  
     1.6  NAME=BackupPC
     1.7 -DESC="backuppc deamon"
     1.8 +DESC="$(_ '%s daemon' backuppc)"
     1.9  DAEMON=/usr/bin/BackupPC
    1.10  OPTIONS=$BACKUPPC_OPTIONS
    1.11  [ -n "$OPTIONS" ] || OPTIONS="-d"
    1.12 @@ -18,45 +18,44 @@
    1.13  case "$1" in
    1.14    start)
    1.15      if active_pidfile $PIDFILE $NAME ; then
    1.16 -      echo "$NAME already running."
    1.17 +      _ '%s is already running.' $NAME
    1.18        exit 1
    1.19      fi
    1.20 -    echo -n "Starting $DESC: $NAME... "
    1.21 +    action 'Starting %s: %s...' "$DESC" $NAME
    1.22      su -s /bin/sh -c "$DAEMON $OPTIONS" www
    1.23 -    pidof $NAME | awk '{ print $1 }' > $PIDFILE
    1.24 +    pidof $NAME | awk '{print $1}' > $PIDFILE
    1.25      status
    1.26      ;;
    1.27    stop)
    1.28      if ! active_pidfile $PIDFILE $NAME ; then
    1.29 -      echo "$NAME is not running."
    1.30 +      _ '%s is not running.' $NAME
    1.31        exit 1
    1.32      fi
    1.33 -    echo -n "Stopping $DESC: $NAME... "
    1.34 -    kill `cat $PIDFILE`
    1.35 +    action 'Stopping %s: %s...' "$DESC" $NAME
    1.36 +    kill $(cat $PIDFILE)
    1.37      rm $PIDFILE
    1.38      status
    1.39      ;;
    1.40    restart)
    1.41      if ! active_pidfile $PIDFILE $NAME ; then
    1.42 -      echo "$NAME is not running."
    1.43 +      _ '%s is not running.' $NAME
    1.44        exit 1
    1.45      fi
    1.46 -    echo -n "Restarting $DESC: $NAME... "
    1.47 -    kill `cat $PIDFILE`
    1.48 +    action 'Restarting %s: %s...' "$DESC" $NAME
    1.49 +    kill $(cat $PIDFILE)
    1.50      rm $PIDFILE
    1.51      sleep 2
    1.52      su -c "$DAEMON $OPTIONS" www
    1.53 -    pidof $NAME | awk '{ print $1 }' > $PIDFILE
    1.54 +    pidof $NAME | awk '{print $1}' > $PIDFILE
    1.55      status
    1.56      ;;
    1.57    reload)
    1.58 -    kill -1 `cat $PIDFILE`
    1.59 +    kill -1 $(cat $PIDFILE)
    1.60      status
    1.61      ;;
    1.62    *)
    1.63 -    echo ""
    1.64 -    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    1.65 -    echo ""
    1.66 +    emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart|reload]"
    1.67 +    newline
    1.68      exit 1
    1.69      ;;
    1.70  esac