updated on Sun Jan 15 20:01:04 UTC 2012
[aur-mirror.git] / hdapsd / hdapsd.rc.d
blobd57b8206857ead3e4487dde67e8677404576c75d
1 #!/bin/bash
3 [ -f /etc/conf.d/hdapsd ] && . /etc/conf.d/hdapsd
5 . /etc/rc.conf
6 . /etc/rc.d/functions
8 PIDFILE=/var/run/hdapsd.pid
9 PID=`cat $PIDFILE 2> /dev/null`
11 case "$1" in
12 start)
13 stat_busy "Starting hdapsd"
15 ## The daemon will try to autoload the kernel module
16 #if [ ! -d /sys/devices/platform/hdaps ]; then
17 # stat_fail
18 # echo "You need to load the hdaps kernel module."
19 # exit 1
20 #fi
22 ## Set up options to the hdapsd daemon
23 HDAPSD_OPTS="-bp -d ${DEVICE:-sda}"
24 [ ! -z "$SENSITIVITY" ] && HDAPSD_OPTS="$HDAPSD_OPTS -s $SENSITIVITY"
25 [ "$ADAPTIVE" = "yes" ] && HDAPSD_OPTS="$HDAPSD_OPTS -a"
26 [ "$SYSLOG" = "yes" ] && HDAPSD_OPTS="$HDAPSD_OPTS -l"
27 [ "$FORCE" = "yes" ] && HDAPSD_OPTS="$HDAPSD_OPTS -f"
28 [ -z "$PID" ] && /usr/sbin/hdapsd $HDAPSD_OPTS
29 if [ $? -gt 0 ]; then
30 stat_fail
31 else
32 add_daemon hdapsd
33 stat_done
36 stop)
37 stat_busy "Stopping hdapsd"
38 [ ! -z "$PID" ] && kill $PID &> /dev/null
39 if [ $? -gt 0 ]; then
40 stat_fail
41 else
42 rm_daemon hdapsd
43 stat_done
46 restart)
47 $0 stop
48 sleep 1
49 $0 start
52 echo "usage: $0 {start|stop|restart}"
53 esac