updated on Sun Jan 22 16:00:49 UTC 2012
[aur-mirror.git] / autopoweroff / autopoweroff.rc
blob00fd3a11a9cc1a9e43a988bb76715153e4b6421b
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 PID=$(pidof -o %PPID /usr/sbin/autopoweroffd)
7 LOG=/var/log/autopoweroff.log
9 case "$1" in
10 start)
11 stat_busy "Starting Autopoweroff Daemon"
12 [[ -z $PID ]] && /usr/sbin/autopoweroffd >> $LOG 2>&1
13 if [[ $? -gt 0 ]]; then
14 stat_fail
15 else
16 add_daemon autopoweroff
17 stat_done
20 stop)
21 stat_busy "Stopping Autopoweroff Daemon"
22 [[ -n $PID ]] && kill $PID &> $LOG
23 sleep 1
24 if [[ $? -gt 0 ]]; then
25 stat_fail
26 else
27 rm_daemon autopoweroff
28 stat_done
31 restart)
32 $0 stop
33 sleep 1
34 $0 start
37 echo "usage: $0 {start|stop|restart}"
38 esac
39 exit 0