hd-idle/debian/hd-idle.init
2025-08-06 15:37:55 +02:00

51 lines
1.1 KiB
Bash

#!/bin/sh
set -e
### 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
# 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
[ -r /etc/default/hd-idle ] && . /etc/default/hd-idle
# 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 --background --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
;;
status)
status_of_proc $DAEMON hd-idle && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/hd-idle start/stop/restart/force-reload"
exit 1
;;
esac