ports/opt (3.1): smartmontools: improved rc script
commit 40b3bd179880a84c2a6faacf780b6cbce62bd8a2 Author: Juergen Daubert <jue@jue.li> Date: Mon Apr 13 18:57:44 2015 +0200 smartmontools: improved rc script diff --git a/smartmontools/.md5sum b/smartmontools/.md5sum index 770440c..4c58c65 100644 --- a/smartmontools/.md5sum +++ b/smartmontools/.md5sum @@ -1,2 +1,2 @@ -482b47077510dbac2bf8ce72907ff9f8 smartd +ba7af77aa9b178ebd30766bc26aae116 smartd 2ea0c62206e110192a97b59291b17f54 smartmontools-6.3.tar.gz diff --git a/smartmontools/Pkgfile b/smartmontools/Pkgfile index dd39002..7423373 100644 --- a/smartmontools/Pkgfile +++ b/smartmontools/Pkgfile @@ -5,7 +5,7 @@ name=smartmontools version=6.3 -release=1 +release=2 source=(http://downloads.sourceforge.net/project/$name/$name/$version/$name-$version... \ smartd) diff --git a/smartmontools/smartd b/smartmontools/smartd index c7c1396..640bbfa 100644 --- a/smartmontools/smartd +++ b/smartmontools/smartd @@ -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
participants (1)
-
crux@crux.nu