-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from adelolmo/feature/41-systemv
Add systemv init script
- Loading branch information
Showing
2 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |