wok view smartmontools/stuff/etc/init.d/smartd @ 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/smartd : Start, stop and restart Smartmontools (SMART) daemon on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start SMART monitoring at boot time, just put smartd 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=smartd
12 DESC="$(_ 'Smartmontools (SMART) Daemon')"
13 DAEMON=/usr/sbin/smartd
15 PIDFILE=/var/run/smartd.pid
16 OPTIONS="-p $PIDFILE"
18 case "$1" in
19 start)
20 if active_pidfile $PIDFILE smartd ; then
21 _ '%s is already running.' $NAME
22 exit 1
23 fi
24 action 'Starting %s: %s...' "$DESC" $NAME
25 $DAEMON $OPTIONS
26 status
27 ;;
28 stop)
29 if ! active_pidfile $PIDFILE smartd ; then
30 _ '%s is not running.' $NAME
31 exit 1
32 fi
33 action 'Stopping %s: %s...' "$DESC" $NAME
34 kill $(cat $PIDFILE)
35 status
36 ;;
37 restart)
38 if ! active_pidfile $PIDFILE smartd ; then
39 _ '%s is not running.' $NAME
40 exit 1
41 fi
42 action 'Restarting %s: %s...' "$DESC" $NAME
43 kill $(cat $PIDFILE)
44 sleep 2
45 $DAEMON $OPTIONS
46 status
47 ;;
48 *)
49 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
50 newline
51 exit 1
52 ;;
53 esac
55 exit 0