$NetBSD: patch-ad,v 1.3 2002/12/01 22:32:27 bouyer Exp $

--- distributions/netbsd/apccontrol.sh.in.orig	Sun Dec  1 13:32:57 2002
+++ distributions/netbsd/apccontrol.sh.in	Sun Dec  1 13:31:47 2002
@@ -50,28 +50,36 @@
         ;;
         commfailure)
                 printf "Warning serial port communications with UPS lost." | wall
+                /usr/bin/logger -p user.info -t apccontrol "Warning serial port communications with UPS lost."
         ;;
         commok)
                 printf "Serial communciations with UPS restored." | wall
+                /usr/bin/logger -p user.info -t apccontrol "Serial communciations with UPS restored."
         ;;
         powerout)
                 printf "Warning power loss detected." | wall
+                /usr/bin/logger -p user.info -t apccontrol "Warning power loss detected."
         ;;
         onbattery)
                 printf "Power failure. Running on UPS batteries." | wall
+                /usr/bin/logger -p user.info -t apccontrol "Power failure. Running on UPS batteries."
         ;;
         failing)
                 printf "UPS battery power exhaused. Doing shutdown.\n" | wall
+                /usr/bin/logger -p user.info -t apccontrol "UPS battery power exhaused. Doing shutdown.\n"
         ;;
         timeout)
                 printf "UPS battery runtime limit exceded. Doing shutdown.\n" | wall
+                /usr/bin/logger -p user.info -t apccontrol "UPS battery runtime limit exceded. Doing shutdown.\n"
         ;;
         loadlimit)
                 printf "UPS battery discharge limit reached. Doing shutdown.\n" | wall
+                /usr/bin/logger -p user.info -t apccontrol "UPS battery discharge limit reached. Doing shutdown.\n"
         ;;
         runlimit)
                 printf "UPS battery runtime percent reached. Doing shutdown.\n" \
                         | wall
+                /usr/bin/logger -p user.info -t apccontrol "UPS battery runtime percent reached. Doing shutdown.\n"
         ;;
         doreboot)
                 printf "Beginning Reboot Sequence" | wall
@@ -83,8 +91,10 @@
         ;;
         mainsback)
                 printf "Power has returned..." | wall
+                /usr/bin/logger -p user.info -t apccontrol "Power has returned..."
                 if [ -f @PWRFAILDIR@/powerfail ] ; then
                    printf "Continuing with shutdown.  I hope you don't have a linux box as the UPS master ..."  | wall
+                   /usr/bin/logger -p user.info -t apccontrol "Continuing with shutdown.  I hope you don't have a linux box as the UPS master ..."
                 fi
         ;;
         annoyme)
@@ -93,11 +103,13 @@
         emergency)
                 printf "Emergency Shutdown. Possible UPS battery failure." \
                         | wall
+                /usr/bin/logger -p user.info -t apccontrol "Emergency Shutdown. Possible UPS battery failure."
                 ${SHUTDOWN} -h now "apcupsd emergency shutdown"
         ;;
         changeme)
                 printf "Emergency! UPS batteries have failed\nChange them NOW" \
                         | wall
+                /usr/bin/logger -p user.info -t apccontrol "Emergency! UPS batteries have failed\nChange them NOW"
         ;;
         remotedown)
                 printf "Remote Shutdown.\nBeginning Shutdown Sequence." | wall
