smartmontools: improved rc script

This commit is contained in:
Juergen Daubert 2015-04-13 18:57:44 +02:00
parent 2760fcebfb
commit 40b3bd1798
3 changed files with 20 additions and 7 deletions

View File

@ -1,2 +1,2 @@
482b47077510dbac2bf8ce72907ff9f8 smartd
ba7af77aa9b178ebd30766bc26aae116 smartd
2ea0c62206e110192a97b59291b17f54 smartmontools-6.3.tar.gz

View File

@ -5,7 +5,7 @@
name=smartmontools
version=6.3
release=1
release=2
source=(http://downloads.sourceforge.net/project/$name/$name/$version/$name-$version.tar.gz \
smartd)

View File

@ -3,23 +3,36 @@
# /etc/rc.d/smartd: start/stop smartd daemon
#
SSD=/sbin/start-stop-daemon
PROG=/usr/sbin/smartd
PID=/var/run/smartd.pid
OPTS="-p $PID"
case $1 in
start)
/usr/sbin/smartd -p /var/run/smartd.pid
$SSD --start --pidfile $PID --exec $PROG -- $OPTS
;;
stop)
killall -q /usr/sbin/smartd
$SSD --stop --retry 10 --pidfile $PID
;;
restart)
$0 stop
sleep 2
$0 start
;;
reload)
kill -HUP `pidof smartd`
$SSD --stop --pidfile $PID --signal HUP
;;
status)
$SSD --status --pidfile $PID
case $? in
0) echo "$PROG is running with pid $(cat $PID)" ;;
1) echo "$PROG is not running but the pid file $PID exists" ;;
3) echo "$PROG is not running" ;;
4) echo "Unable to determine the program status" ;;
esac
;;
*)
echo "usage: $0 [start|stop|restart|reload]"
echo "usage: $0 [start|stop|restart|reload|status]"
;;
esac