There were a few bugs in the patch previously attached to this bug;
FWIW, here's an updated version (against 3.10.17-2).
--- apcupsd.dpkg-dist 2005-04-03 06:40:19.000000000 -0500
+++ apcupsd 2005-11-20 20:21:23.000000000 -0600
@@ -6,6 +6,8 @@
DAEMON=/sbin/apcupsd
CONFIG=/etc/default/apcupsd
+CONFIGFILES=/etc/apcupsd/apcupsd*.conf
+POWERFAIL=/var/spool/apcupsd/powerfail
test -x $DAEMON || exit 0
@@ -24,36 +26,50 @@
case "$1" in
start)
- echo -n "Starting APC UPS power management: "
- rm -f /etc/apcupsd/powerfail
- if [ "`pidof apcupsd`" = "" ]
- then
- start-stop-daemon --start --quiet --exec $DAEMON
- echo "apcupsd."
- else
+ echo -n "Starting APC UPS power management:"
+ rm -f $POWERFAIL
+ for f in $CONFIGFILES
+ do
+ CONF=`echo $f | sed 's|^.*/\([^.]*\)\.conf$|\1|'`
+ PIDFILE=/var/run/${CONF}.pid
+ echo -n " $CONF"
+ if [ ! -f $PIDFILE -o ! -e /proc/`cat $PIDFILE 2>/dev/null` ]
+ then
+ start-stop-daemon --start --pidfile $PIDFILE --quiet \
+ --exec $DAEMON -- -f $f -P $PIDFILE \
+ || echo -n " failed!"
+ sleep 2
+ else
echo ""
echo "A copy of the daemon is still running. If you
just stopped it,"
echo "please wait about 5 seconds for it to shut down."
exit 0
- fi
+ fi
+ done
+ echo "."
;;
stop)
- echo -n "Stopping APC UPS power management: "
- #start-stop-daemon --stop --quiet --exec $DAEMON
- echo "apcupsd."
- start-stop-daemon --stop --pidfile /var/run/apcupsd.pid || echo
"Not Running."
- rm -f /var/run/apcupsd.pid
- echo ""
-
+ echo -n "Stopping APC UPS power management:"
+ for f in $CONFIGFILES
+ do
+ CONF=`echo $f | sed 's|^.*/\([^.]*\)\.conf$|\1|'`
+ PIDFILE=/var/run/${CONF}.pid
+ echo -n " $CONF"
+ start-stop-daemon --stop --pidfile $PIDFILE --quiet \
+ --exec $DAEMON \
+ || echo -n " failed: not running?"
+ done
+ echo "."
;;
restart|force-reload)
- echo -n "Restarting APC UPS power management: "
+ echo -n "Restarting APC UPS power management:"
$0 stop
sleep 10
$0 start
;;
status)
#/sbin/apcaccess status
+ # XXX only displays status for primary UPS
$APCACCESS status
;;
*)
--Nicholas
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]