diff options
Diffstat (limited to 'src/apcupsd/apcupsd')
-rwxr-xr-x | src/apcupsd/apcupsd | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/apcupsd/apcupsd b/src/apcupsd/apcupsd new file mode 100755 index 0000000..8a96e9b --- /dev/null +++ b/src/apcupsd/apcupsd @@ -0,0 +1,39 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +PID=`pidof -o %PPID /sbin/apcupsd` +case "$1" in + start) + stat_busy "Starting APCUPSD Daemon" + [ -z "$PID" ] && /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon apcupsd + stat_done + fi + ;; + stop) + stat_busy "Stopping APCUPSD Daemon" + [ ! -z "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon apcupsd + stat_done + fi + ;; + restart) + $0 stop + sleep 2 + $0 start + ;; + status) + /sbin/apcaccess status + ;; + *) + echo "usage: $0 {start|stop|restart|status}" +esac +exit 0 |