Fri Jul 06 2001 Than Ngo <than@redhat.com> 0.45.0-2 - rebuild Wed Jun 13 2001 Than Ngo <than@redhat.com> - update to 0.45.0 - add some patches from alane@geeksrus.net (bug #44361, #44363) Sun Apr 22 2001 Than Ngo <than@redhat.com> - add all available UPS drivers (Bug #36937) Fri Apr 13 2001 Than Ngo <than@redhat.com> - update to 0.44.3 (Bug #35255)
104 lines
1.6 KiB
Bash
104 lines
1.6 KiB
Bash
#!/bin/bash
|
|
#
|
|
# chkconfig: - 26 74
|
|
# description: The ups daemon automatically starts a shutdown
|
|
# processname: upsd
|
|
# config: /etc/ups/
|
|
|
|
# Source function library.
|
|
if [ -f /etc/init.d/functions ]; then
|
|
. /etc/init.d/functions
|
|
elif [ -f /etc/rc.d/init.d/functions ]; then
|
|
. /etc/rc.d/init.d/functions
|
|
else
|
|
exit 0
|
|
fi
|
|
|
|
# Get config.
|
|
if [ -f /etc/sysconfig/ups ]; then
|
|
. /etc/sysconfig/ups
|
|
else
|
|
SERVER="no"
|
|
fi
|
|
|
|
start() {
|
|
if [ "$SERVER" = "yes" ]; then
|
|
# Exit if server = yes and model = NONE (not configured)
|
|
|
|
if [ "$MODEL" = "NONE" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
echo -n $"Starting $MODEL: "
|
|
daemon /usr/bin/$MODEL $OPTIONS $DEVICE
|
|
echo
|
|
|
|
prog="upsd"
|
|
echo -n $"Starting $prog: "
|
|
daemon /usr/sbin/upsd
|
|
RETVAL=$?
|
|
echo
|
|
|
|
echo -n $"Starting UPS monitor (master): "
|
|
daemon /usr/sbin/upsmon
|
|
echo
|
|
else
|
|
echo -n $"Starting UPS monitor (slave): "
|
|
daemon /usr/sbin/upsmon
|
|
echo
|
|
fi
|
|
|
|
[ "$RETVAL" = 0 ] && touch /var/lock/subsys/ups
|
|
}
|
|
|
|
stop() {
|
|
echo -n $"Stopping UPS monitor: "
|
|
killproc upsmon
|
|
echo
|
|
|
|
if [ "$SERVER" = "yes" ]; then
|
|
prog="upsd"
|
|
echo -n $"Stopping $prog: "
|
|
killproc upsd
|
|
RETVAL=$?
|
|
echo
|
|
|
|
echo -n $"Shutting down $MODEL: "
|
|
killproc $MODEL
|
|
echo
|
|
fi
|
|
[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/ups
|
|
}
|
|
|
|
restart() {
|
|
stop
|
|
start
|
|
}
|
|
|
|
# See how we are called.
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
restart)
|
|
restart
|
|
;;
|
|
condrestart)
|
|
[ -f /var/lock/subsys/ups ] && restart || :
|
|
;;
|
|
status)
|
|
if [ "$HOST" = "localhost" ]; then
|
|
status upsd
|
|
status $MODEL
|
|
fi
|
|
status upsmon
|
|
;;
|
|
*)
|
|
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
|
|
exit 1
|
|
esac
|
|
|
|
exit $RETVAL
|