#! /bin/bash # # spindown Start/Stop the spindown daemon. # # chkconfig: - 90 60 # description: Daemon to spindown idle disks # # processname: spindown # config: /etc/spindown.conf # pidfile: /var/run/spindown/spindown.pid # ### BEGIN INIT INFO # Provides: spindown # Required-Start: $syslog # Required-Stop: $syslog # Short-Description: Daemon to spindown idle disks # Description: pindown idle disks and saving energy and giving the disks a longer lifetime. # ### END INIT INFO # Source function library. . /etc/init.d/functions RETVAL=0 # See how we were called. prog="spindownd" start() { gprintf "Starting %s: " "$prog" daemon spindownd -c /etc/spindown.conf -f /var/run/spindown.fifo < /dev/null RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/spindownd return $RETVAL } stop() { gprintf "Stopping %s: " "$prog" killproc spindownd RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/spindownd return $RETVAL } rhstatus() { status spindownd } restart() { stop start } reload() { gprintf "Reloading collecting daemon configuration: " killproc spindownd -HUP retval=$? echo return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) reload ;; status) rhstatus ;; condrestart) [ -f /var/lock/subsys/spindownd ] && restart || : ;; *) gprintf "Usage: %s {start|stop|status|reload|restart|condrestart}\n" "$0" exit 1 esac exit $?