updated on Thu Jan 12 04:00:44 UTC 2012
[aur-mirror.git] / network-ups-tools / upsd.init
blobacdd1152b0585b37ac04f0657224c9a9fa5f8765
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 PID=`pidof -o %PPID /usr/sbin/upsd`
7 case "$1" in
8 start)
9 stat_busy "Starting UPSd Daemon"
10 /usr/bin/upsdrvctl start &> /dev/null
11 [ -z "$PID" ] && /usr/sbin/upsd &>/dev/null
12 /usr/sbin/upsmon &>/dev/null
13 if [ $? -gt 0 ]; then
14 stat_fail
15 else
16 add_daemon upsd
17 stat_done
21 stop)
22 stat_busy "Stopping UPSd Daemon"
23 /usr/sbin/upsmon -c stop &> /dev/null
24 /usr/sbin/upsd -c stop &> /dev/null
25 /usr/bin/upsdrvctl stop &> /dev/null
26 if [ $? -gt 0 ]; then
27 stat_fail
28 else
29 rm_daemon upsd
30 stat_done
34 restart)
35 $0 stop
36 sleep 3
37 $0 start
41 cho "usage: $0 {start|stop|restart}"
42 esac
43 exit 0