updated on Sun Jan 15 08:01:04 UTC 2012
[aur-mirror.git] / hd-idle / hd-idle.init
blobf01a9802e7290c3c88d9df04b0dc04363ac8e5f1
1 #!/bin/sh
2 # Based on the Debian init.d script from the original hd-idle tarball.
3 # Modified for Arch Linux by Tilman Blumenbach <tilman@ax86.net>.
5 DAEMON=/usr/sbin/hd-idle
6 HD_IDLE_OPTS="-i 600"
7 START_HD_IDLE=false
9 [ -r /etc/conf.d/hd-idle ] && . /etc/conf.d/hd-idle
11 if [ "$START_HD_IDLE" != "true" ] ; then
12 exit 0
15 # See if the daemon is there
16 test -x $DAEMON || exit 0
18 . /etc/rc.conf
19 . /etc/rc.d/functions
21 APP_PID=`pidof -s "${DAEMON}"`
23 case "$1" in
24 start)
25 stat_busy "Starting the hd-idle daemon"
27 [ -z "$APP_PID" ] && $DAEMON $HD_IDLE_OPTS
28 if [ $? -eq 0 ]; then
29 stat_done
30 add_daemon hd-idle
31 else
32 stat_fail
36 stop)
37 stat_busy "Stopping the hd-idle daemon"
39 [ -n "$APP_PID" ] && kill "$APP_PID"
40 if [ $? -eq 0 ]; then
41 stat_done
42 rm_daemon hd-idle
43 else
44 stat_fail
48 restart|force-reload)
49 $0 stop && sleep 2 && $0 start
53 echo "Usage: /etc/init.d/hd-idle start/stop/restart/force-reload"
54 exit 1
56 esac