wok-6.x diff at/stuff/atd @ 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
'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 | b8f690d89541 |
children | ff5fd8788cd9 |
line diff
1.1 --- a/at/stuff/atd Thu Oct 13 02:28:37 2011 +0000 1.2 +++ b/at/stuff/atd Thu May 26 20:16:45 2016 +0300 1.3 @@ -1,5 +1,5 @@ 1.4 #!/bin/sh 1.5 -# Start, stop and restart a atd deamon on SliTaz, at boot time or 1.6 +# Start, stop and restart a atd deamon on SliTaz, at boot time or 1.7 # with the command line. 1.8 # 1.9 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS 1.10 @@ -8,7 +8,7 @@ 1.11 . /etc/init.d/rc.functions 1.12 1.13 NAME=$(basename $0) 1.14 -DESC="$NAME deamon" 1.15 +DESC="$(_ '%s daemon' $NAME)" 1.16 DAEMON=$(which $NAME) 1.17 eval $(grep -i ^${NAME}_OPTIONS /etc/daemons.conf | sed 's/.*_OPT/OPT/') 1.18 PIDFILE=/var/run/$NAME.pid 1.19 @@ -16,41 +16,40 @@ 1.20 case "$1" in 1.21 start) 1.22 if active_pidfile $PIDFILE $NAME ; then 1.23 - echo "$NAME is already running." 1.24 + _ '%s is already running.' $NAME 1.25 exit 1 1.26 fi 1.27 - echo -n "Starting $DESC: $NAME... " 1.28 - $DAEMON $OPTIONS 1.29 - [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE 1.30 + action 'Starting %s: %s...' "$DESC" $NAME 1.31 + $DAEMON $OPTIONS 1.32 + [ -f $PIDFILE ] || pidof $NAME | awk '{print $1}' > $PIDFILE 1.33 active_pidfile $PIDFILE $NAME 1.34 status 1.35 ;; 1.36 stop) 1.37 if ! active_pidfile $PIDFILE $NAME ; then 1.38 - echo "$NAME is not running." 1.39 + _ '%s is not running.' $NAME 1.40 exit 1 1.41 fi 1.42 - echo -n "Stopping $DESC: $NAME... " 1.43 - kill `cat $PIDFILE` 1.44 + action 'Stopping %s: %s...' "$DESC" $NAME 1.45 + kill $(cat $PIDFILE) 1.46 status 1.47 ;; 1.48 restart) 1.49 if ! active_pidfile $PIDFILE $NAME ; then 1.50 - echo "$NAME is not running." 1.51 + _ '%s is not running.' $NAME 1.52 exit 1 1.53 fi 1.54 - echo -n "Restarting $DESC: $NAME... " 1.55 - kill `cat $PIDFILE` 1.56 + action 'Restarting %s: %s...' "$DESC" $NAME 1.57 + kill $(cat $PIDFILE) 1.58 sleep 2 1.59 $DAEMON $OPTIONS 1.60 - [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE 1.61 + [ -f $PIDFILE ] || pidof $NAME | awk '{print $1}' > $PIDFILE 1.62 active_pidfile $PIDFILE $NAME 1.63 status 1.64 ;; 1.65 -*) 1.66 - echo "" 1.67 - echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" 1.68 - echo "" 1.69 + *) 1.70 + emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" 1.71 + newline 1.72 exit 1 1.73 ;; 1.74 esac