Skip to content

Commit

Permalink
Merge pull request #43 from adelolmo/feature/41-systemv
Browse files Browse the repository at this point in the history
Add systemv init script
  • Loading branch information
adelolmo authored Mar 3, 2021
2 parents cbdc5b6 + ff5e784 commit 5f4b9a6
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build
obj*
debian/hd-idle
debian/debhelper-build-stamp
debian/.debhelper
debian/*.debhelper
debian/files
debian/hd-idle.debhelper.log
debian/hd-idle.substvars
Expand Down
50 changes: 50 additions & 0 deletions debian/hd-idle.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/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 --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

0 comments on commit 5f4b9a6

Please sign in to comment.