54 lines
1.0 KiB
Bash
Executable File
54 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: hd-idle
|
|
# Required-Start: $local_fs
|
|
# Required-Stop: $local_fs
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: start hd-idle daemon (spin down idle hard disks)
|
|
### END INIT INFO
|
|
|
|
|
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
|
|
|
DAEMON=/usr/sbin/hd-idle
|
|
HD_IDLE_OPTS="-i 600"
|
|
START_HD_IDLE=false
|
|
|
|
[ -r /etc/default/hd-idle ] && . /etc/default/hd-idle
|
|
|
|
if [ "$START_HD_IDLE" != "true" ] ; then
|
|
exit 0
|
|
fi
|
|
|
|
# See if the daemon is there
|
|
test -x $DAEMON || exit 0
|
|
|
|
. /lib/lsb/init-functions
|
|
|
|
case "$1" in
|
|
start)
|
|
log_daemon_msg "Starting the hd-idle daemon" "hd-idle"
|
|
|
|
start-stop-daemon --start --quiet --oknodo --exec $DAEMON -- $HD_IDLE_OPTS
|
|
|
|
log_end_msg $?
|
|
;;
|
|
|
|
stop)
|
|
log_daemon_msg "Stopping the hd-idle daemon" "hd-idle"
|
|
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
|
|
log_end_msg $?
|
|
;;
|
|
|
|
restart|force-reload)
|
|
$0 stop && sleep 2 && $0 start
|
|
;;
|
|
|
|
*)
|
|
echo "Usage: /etc/init.d/hd-idle start/stop/restart/force-reload"
|
|
exit 1
|
|
;;
|
|
esac
|