#!/bin/sh # # Copyright 1999 American Power Conversion, All Rights Reserved # # Revision History: # msamson 01Apr99 For Linux, we have to remove upsoff.cmd, because we cannot # remove this file once all filesystems have been unmounted # in our shutdown script. # msamson 04Oct99 Incorporated standard init fixes from Redhat # (pjones@redhat.com) # # chkconfig: 2345 98 92 # description: Uninterruptable Power Supply Monitoring Daemon # # # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Demon specified configuration. [ -f /etc/sysconfig/upsd ] && . /etc/sysconfig/upsd PWRCHUTE=/usr/lib/powerchute export PWRCHUTE TMPDIR=/tmp export TMPDIR if [ -r /upsoff.cmd ]; then rm -f /upsoff.cmd fi RETVAL=0 # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/upsd ]; then msg_starting UPSd cd $PWRCHUTE daemon upsd RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/upsd else msg_already_running UPSd fi ;; stop) if [ -f /var/lock/subsys/upsd ]; then msg_stopping UPSd killproc upsd rm -f /var/lock/subsys/upsd >/dev/null 2>&1 else msg_not_running UPSd fi ;; status) status upsd exit $? ;; restart|force-reload) $0 stop $0 start exit $? ;; *) msg_usage "$0 {start|stop|restart|force-reload|status}" exit 3 esac exit $RETVAL