head 1.6; access; symbols pkgsrc-2026Q1:1.6.0.46 pkgsrc-2026Q1-base:1.6 pkgsrc-2025Q4:1.6.0.44 pkgsrc-2025Q4-base:1.6 pkgsrc-2025Q3:1.6.0.42 pkgsrc-2025Q3-base:1.6 pkgsrc-2025Q2:1.6.0.40 pkgsrc-2025Q2-base:1.6 pkgsrc-2025Q1:1.6.0.38 pkgsrc-2025Q1-base:1.6 pkgsrc-2024Q4:1.6.0.36 pkgsrc-2024Q4-base:1.6 pkgsrc-2024Q3:1.6.0.34 pkgsrc-2024Q3-base:1.6 pkgsrc-2024Q2:1.6.0.32 pkgsrc-2024Q2-base:1.6 pkgsrc-2024Q1:1.6.0.30 pkgsrc-2024Q1-base:1.6 pkgsrc-2023Q4:1.6.0.28 pkgsrc-2023Q4-base:1.6 pkgsrc-2023Q3:1.6.0.26 pkgsrc-2023Q3-base:1.6 pkgsrc-2023Q2:1.6.0.24 pkgsrc-2023Q2-base:1.6 pkgsrc-2023Q1:1.6.0.22 pkgsrc-2023Q1-base:1.6 pkgsrc-2022Q4:1.6.0.20 pkgsrc-2022Q4-base:1.6 pkgsrc-2022Q3:1.6.0.18 pkgsrc-2022Q3-base:1.6 pkgsrc-2022Q2:1.6.0.16 pkgsrc-2022Q2-base:1.6 pkgsrc-2022Q1:1.6.0.14 pkgsrc-2022Q1-base:1.6 pkgsrc-2021Q4:1.6.0.12 pkgsrc-2021Q4-base:1.6 pkgsrc-2021Q3:1.6.0.10 pkgsrc-2021Q3-base:1.6 pkgsrc-2021Q2:1.6.0.8 pkgsrc-2021Q2-base:1.6 pkgsrc-2021Q1:1.6.0.6 pkgsrc-2021Q1-base:1.6 pkgsrc-2020Q4:1.6.0.4 pkgsrc-2020Q4-base:1.6 pkgsrc-2020Q3:1.6.0.2 pkgsrc-2020Q3-base:1.6 pkgsrc-2020Q2:1.5.0.64 pkgsrc-2020Q2-base:1.5 pkgsrc-2020Q1:1.5.0.44 pkgsrc-2020Q1-base:1.5 pkgsrc-2019Q4:1.5.0.66 pkgsrc-2019Q4-base:1.5 pkgsrc-2019Q3:1.5.0.62 pkgsrc-2019Q3-base:1.5 pkgsrc-2019Q2:1.5.0.60 pkgsrc-2019Q2-base:1.5 pkgsrc-2019Q1:1.5.0.58 pkgsrc-2019Q1-base:1.5 pkgsrc-2018Q4:1.5.0.56 pkgsrc-2018Q4-base:1.5 pkgsrc-2018Q3:1.5.0.54 pkgsrc-2018Q3-base:1.5 pkgsrc-2018Q2:1.5.0.52 pkgsrc-2018Q2-base:1.5 pkgsrc-2018Q1:1.5.0.50 pkgsrc-2018Q1-base:1.5 pkgsrc-2017Q4:1.5.0.48 pkgsrc-2017Q4-base:1.5 pkgsrc-2017Q3:1.5.0.46 pkgsrc-2017Q3-base:1.5 pkgsrc-2017Q2:1.5.0.42 pkgsrc-2017Q2-base:1.5 pkgsrc-2017Q1:1.5.0.40 pkgsrc-2017Q1-base:1.5 pkgsrc-2016Q4:1.5.0.38 pkgsrc-2016Q4-base:1.5 pkgsrc-2016Q3:1.5.0.36 pkgsrc-2016Q3-base:1.5 pkgsrc-2016Q2:1.5.0.34 pkgsrc-2016Q2-base:1.5 pkgsrc-2016Q1:1.5.0.32 pkgsrc-2016Q1-base:1.5 pkgsrc-2015Q4:1.5.0.30 pkgsrc-2015Q4-base:1.5 pkgsrc-2015Q3:1.5.0.28 pkgsrc-2015Q3-base:1.5 pkgsrc-2015Q2:1.5.0.26 pkgsrc-2015Q2-base:1.5 pkgsrc-2015Q1:1.5.0.24 pkgsrc-2015Q1-base:1.5 pkgsrc-2014Q4:1.5.0.22 pkgsrc-2014Q4-base:1.5 pkgsrc-2014Q3:1.5.0.20 pkgsrc-2014Q3-base:1.5 pkgsrc-2014Q2:1.5.0.18 pkgsrc-2014Q2-base:1.5 pkgsrc-2014Q1:1.5.0.16 pkgsrc-2014Q1-base:1.5 pkgsrc-2013Q4:1.5.0.14 pkgsrc-2013Q4-base:1.5 pkgsrc-2013Q3:1.5.0.12 pkgsrc-2013Q3-base:1.5 pkgsrc-2013Q2:1.5.0.10 pkgsrc-2013Q2-base:1.5 pkgsrc-2013Q1:1.5.0.8 pkgsrc-2013Q1-base:1.5 pkgsrc-2012Q4:1.5.0.6 pkgsrc-2012Q4-base:1.5 pkgsrc-2012Q3:1.5.0.4 pkgsrc-2012Q3-base:1.5 pkgsrc-2012Q2:1.5.0.2 pkgsrc-2012Q2-base:1.5 pkgsrc-2012Q1:1.4.0.48 pkgsrc-2012Q1-base:1.4 pkgsrc-2011Q4:1.4.0.46 pkgsrc-2011Q4-base:1.4 pkgsrc-2011Q3:1.4.0.44 pkgsrc-2011Q3-base:1.4 pkgsrc-2011Q2:1.4.0.42 pkgsrc-2011Q2-base:1.4 pkgsrc-2011Q1:1.4.0.40 pkgsrc-2011Q1-base:1.4 pkgsrc-2010Q4:1.4.0.38 pkgsrc-2010Q4-base:1.4 pkgsrc-2010Q3:1.4.0.36 pkgsrc-2010Q3-base:1.4 pkgsrc-2010Q2:1.4.0.34 pkgsrc-2010Q2-base:1.4 pkgsrc-2010Q1:1.4.0.32 pkgsrc-2010Q1-base:1.4 pkgsrc-2009Q4:1.4.0.30 pkgsrc-2009Q4-base:1.4 pkgsrc-2009Q3:1.4.0.28 pkgsrc-2009Q3-base:1.4 pkgsrc-2009Q2:1.4.0.26 pkgsrc-2009Q2-base:1.4 pkgsrc-2009Q1:1.4.0.24 pkgsrc-2009Q1-base:1.4 pkgsrc-2008Q4:1.4.0.22 pkgsrc-2008Q4-base:1.4 pkgsrc-2008Q3:1.4.0.20 pkgsrc-2008Q3-base:1.4 cube-native-xorg:1.4.0.18 cube-native-xorg-base:1.4 pkgsrc-2008Q2:1.4.0.16 pkgsrc-2008Q2-base:1.4 cwrapper:1.4.0.14 pkgsrc-2008Q1:1.4.0.12 pkgsrc-2008Q1-base:1.4 pkgsrc-2007Q4:1.4.0.10 pkgsrc-2007Q4-base:1.4 pkgsrc-2007Q3:1.4.0.8 pkgsrc-2007Q3-base:1.4 pkgsrc-2007Q2:1.4.0.6 pkgsrc-2007Q2-base:1.4 pkgsrc-2007Q1:1.4.0.4 pkgsrc-2007Q1-base:1.4 pkgsrc-2006Q4:1.4.0.2 pkgsrc-2006Q4-base:1.4 pkgsrc-2006Q3:1.3.0.26 pkgsrc-2006Q3-base:1.3 pkgsrc-2006Q2:1.3.0.24 pkgsrc-2006Q2-base:1.3 pkgsrc-2006Q1:1.3.0.22 pkgsrc-2006Q1-base:1.3 pkgsrc-2005Q4:1.3.0.20 pkgsrc-2005Q4-base:1.3 pkgsrc-2005Q3:1.3.0.18 pkgsrc-2005Q3-base:1.3 pkgsrc-2005Q2:1.3.0.16 pkgsrc-2005Q2-base:1.3 pkgsrc-2005Q1:1.3.0.14 pkgsrc-2005Q1-base:1.3 pkgsrc-2004Q4:1.3.0.12 pkgsrc-2004Q4-base:1.3 pkgsrc-2004Q3:1.3.0.10 pkgsrc-2004Q3-base:1.3 pkgsrc-2004Q2:1.3.0.8 pkgsrc-2004Q2-base:1.3 pkgsrc-2004Q1:1.3.0.6 pkgsrc-2004Q1-base:1.3 pkgsrc-2003Q4:1.3.0.4 pkgsrc-2003Q4-base:1.3 netbsd-1-6-1:1.3.0.2 netbsd-1-6-1-base:1.3 netbsd-1-6:1.2.0.8 netbsd-1-6-RELEASE-base:1.2 pkgviews:1.2.0.4 pkgviews-base:1.2 buildlink2:1.2.0.2 buildlink2-base:1.2 netbsd-1-5-PATCH003:1.2 netbsd-1-5-PATCH001:1.2 netbsd-1-5-RELEASE:1.2 netbsd-1-4-PATCH003:1.2 netbsd-1-4-PATCH002:1.1.1.1 pkgsrc-base:1.1.1.1 TNF:1.1.1; locks; strict; comment @# @; 1.6 date 2020.09.19.13.50.48; author taca; state Exp; branches; next 1.5; commitid 5Wq8qcCEfJ2taFoC; 1.5 date 2012.05.07.12.55.23; author shattered; state Exp; branches; next 1.4; 1.4 date 2006.11.15.21.46.25; author bouyer; state Exp; branches; next 1.3; 1.3 date 2002.12.01.22.32.27; author bouyer; state Exp; branches; next 1.2; 1.2 date 2000.08.05.07.31.18; author jlam; state Exp; branches; next 1.1; 1.1 date 2000.01.21.19.15.59; author bouyer; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2000.01.21.19.15.59; author bouyer; state Exp; branches; next ; desc @@ 1.6 log @sysutils/apcupsd: update to 3.14.14 Update apcupsd package to 3.14.14. 3.14.14 -- 31 May 2016 BUG FIXES * win32: Fix missing DLLs when installing only apctray * Fixes for socket error handling. Resolves apcaccess crash when connection fails as well as several other theoretical issues. * MODBUS/USB error handling (COMMLOST) improvements for faulty USB links * Fix hiddev binding when usbfs is mounted on /dev/bus/usb instead of /proc/bus/usb. This is necessary for switching between MODBUS/USB and USB/HID on Linux. * Update GPLv2 text and FSF address to match current versions from FSF. * Various fixes for potential issues suggested by Coverity Scan * MacOS X port support for El Capitan System Integrity Protection (SIP) aka "rootless" * Fix shutdown failure on Windows when UPSNAME includes spaces * Fix building bsd-usb driver (This was broken when modbus-usb support was added.) FEATURES * Add status display for output current as well as apparent power @ text @$NetBSD: patch-ad,v 1.5 2012/05/07 12:55:23 shattered Exp $ * apccontrol script. --- platforms/netbsd/apccontrol.in.orig 2012-04-21 20:53:17.000000000 +0000 +++ platforms/netbsd/apccontrol.in @@@@ -0,0 +1,147 @@@@ +#!@@SCRIPTSHELL@@ +# +# Copyright (C) 1999-2002 Riccardo Facchetti +# +# for apcupsd release @@VERSION@@ (@@DATE@@) - @@DISTNAME@@ +# +# @@configure_input@@ +# + +# +# These variables are needed for set up the autoconf other variables. +# +prefix=@@prefix@@ +exec_prefix=@@exec_prefix@@ + +APCPID=@@PIDDIR@@/apcupsd.pid +APCUPSD=@@sbindir@@/apcupsd +SHUTDOWN=@@SHUTDOWN@@ +SCRIPTSHELL=@@SCRIPTSHELL@@ +SCRIPTDIR=@@sysconfdir@@ + +# +# This piece is to substitute the default behaviour with your own script, +# perl, or C program. +# You can customize every single command creating an executable file (may be a +# script or a compiled program) and calling it the same as the $1 parameter +# passed by apcupsd to this script. +# +# After executing your script, apccontrol continues with the default action. +# If you do not want apccontrol to continue, exit your script with exit +# code 99. E.g. "exit 99". +# +# WARNING: the apccontrol file will be overwritten every time you update your +# apcupsd, doing `make install'. Your own customized scripts will _not_ be +# overwritten. If you wish to make changes to this file (discouraged), you +# should change apccontrol.sh.in and then rerun the configure process. +# +if [ -f ${SCRIPTDIR}/${1} -a -x ${SCRIPTDIR}/${1} ] +then + ${SCRIPTDIR}/${1} ${2} ${3} ${4} + # exit code 99 means he does not want us to do default action + if [ $? = 99 ] ; then + exit 0 + fi +fi + +case "$1" in + killpower) + printf "UPS now committed to shut down" | wall +# echo "Apccontrol doing: ${APCUPSD} --killpower" +# sleep 10 +# ${APCUPSD} --killpower + ;; + commfailure) + printf "Communications with UPS lost." | wall + /usr/bin/logger -p user.info -t apccontrol "Warning, serial port communications with UPS lost." + ;; + commok) + printf "Communications with UPS restored." | wall + /usr/bin/logger -p user.info -t apccontrol "Communications 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." + ;; + offbattery) + ;; + 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." | wall + /usr/bin/logger -p user.info -t apccontrol "Continuing with shutdown." + fi + ;; + failing) + printf "UPS battery power exhaused. Doing shutdown.\n" | wall + /usr/bin/logger -p user.info -t apccontrol "UPS battery power exhaused. Doing shutdown." + ;; + timeout) + printf "UPS battery runtime limit exceeded. Doing shutdown.\n" | wall + /usr/bin/logger -p user.info -t apccontrol "UPS battery runtime limit exceeded. Doing shutdown." + ;; + 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." + ;; + 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." + ;; + doreboot) + printf "Beginning Reboot Sequence" | wall + ${SHUTDOWN} -r now "apcupsd initiated reboot" + ;; + doshutdown) + printf "Beginning Shutdown Sequence" | wall + ${SHUTDOWN} -h now "apcupsd initiated shutdown" + ;; + annoyme) + printf "Power problems, please logoff." | wall + ;; + emergency) + printf "Emergency Shutdown. Possible UPS battery failure." \ + | wall + /usr/bin/logger -p user.crit -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. Change them NOW." + ;; + remotedown) + printf "Remote Shutdown.\nBeginning Shutdown Sequence." | wall + ${SHUTDOWN} -h now "apcupsd remote shutdown" + ;; + restartme) + echo -n "Restarting APCUPSD Power Management: " + THEPID=`cat ${APCPID}` + kill ${THEPID} + rm -f ${APCPID} + rm -f @@PWRFAILDIR@@/powerfail + rm -f @@nologdir@@/nologin + sleep 5 + `${APCUPSD} --kill-on-powerfail` + echo "apcupsd" + ;; + startselftest) + ;; + endselftest) + ;; + battdetach) + ;; + battattach) + ;; + *) echo "Usage: ${0##*/} command" + echo " warning: this script is intended to be launched by" + echo " apcupsd and should never be launched by users." + exit 1 + ;; +esac @ 1.5 log @Proofread apccontrol's messages. Raise syslog severity for 'emergency' message to 'crit'. @ text @d1 3 a3 1 $NetBSD$ @ 1.4 log @Update to 3.12.4. Summary of changes since 3.8.6: * Support for USB UPSe (not enabled in pkgsrc) * new networking driver (net) that uses the NIS interface rather than the older master/slave networking * The apctest program has been enhanced to do EEPROM programming in a much more interactive way than the prior versions. * Added a ONBATTERYDELAY config, time to switch to onbattery state after a power failure. New event "offbattery", which is the same as mainsback but only sent if we got to state onbattery * new snmp driver, with trap support. * Battery disconnect and reconnect events @ text @d1 1 a1 1 $NetBSD: patch-ad,v 1.3 2002/12/01 22:32:27 bouyer Exp $ d3 2 a4 2 --- /dev/null 2006-11-15 17:26:11.000000000 +0100 +++ platforms/netbsd/apccontrol.in 2006-11-15 17:42:37.000000000 +0100 d61 1 a61 1 + /usr/bin/logger -p user.info -t apccontrol "Warning serial port communications with UPS lost." d64 2 a65 2 + printf "Communciations with UPS restored." | wall + /usr/bin/logger -p user.info -t apccontrol "Communciations with UPS restored." d69 1 a69 1 + /usr/bin/logger -p user.info -t apccontrol "Warning power loss detected." d87 1 a87 1 + /usr/bin/logger -p user.info -t apccontrol "UPS battery power exhaused. Doing shutdown.\n" d91 1 a91 1 + /usr/bin/logger -p user.info -t apccontrol "UPS battery runtime limit exceeded. Doing shutdown.\n" d95 1 a95 1 + /usr/bin/logger -p user.info -t apccontrol "UPS battery discharge limit reached. Doing shutdown.\n" d100 1 a100 1 + /usr/bin/logger -p user.info -t apccontrol "UPS battery runtime percent reached. Doing shutdown.\n" d111 1 a111 1 + printf "Power problems please logoff." | wall d116 1 a116 1 + /usr/bin/logger -p user.info -t apccontrol "Emergency Shutdown. Possible UPS battery failure." d122 1 a122 1 + /usr/bin/logger -p user.info -t apccontrol "Emergency! UPS batteries have failed\nChange them NOW" @ 1.3 log @Update to 3.8.5. Summary of changes since 3.6.2: . New network interface to publish to clients the UPS status . New master/server network code that is more fault tolerant . Internationalization . Use GNU getopt . Logging on syslog . Events logged in a file like APC's PowerChute . Sync code removed: now only async processes are used . Updated documentation (HTTP version) . Bug fixes and enhancements: too many to tell them all . no more powersc script, is has been remplaced with apccontrol . In master/slave configurations, all masters and slaves must be updated at the same time. Version 3.8.0 is not compatible with versions prior to 3.8.0-pre4. . Support for the Back-UPS Office series of UPSes . Fixed dumb UPSes working with the Custom Simple cable. . Correction of a buffer overflow on certain newer UPSes. . More fault tolerant on startup in master/slave configuration. . Additional STATUS variables (number of times on battery, amount of time on batteries, time/date of last transfer to batteries, apcupsd start time/date). . apctest program for testing serial ports. . Automatic notification of certain events by email. . Detects Self Test and reports it as such rather than a Power Failure. . For SmartUPSes, apcupsd does a much better job of adapting to the actual features of the UPS and is more efficient. . Add Battery Runtime Calibration to apctest . UPSNAME now sets upsname if given. Otherwise, apcupsd attempts to get name from UPS, if not found, uses hostname, finally "default". . Added Ambient Temperature and Humidity to multimon (Carl Erhorn) A number of the configuration statements have changed since versions 3.6.2. You should either take the new apcupsd.conf file and modify it, or update your existing file. In general, we recommend starting with the new file. If you have used a prior version of apcupsd, the CONTROL script file (/sbin/powersc) has now been replaced by $SYSCONFDIR/apcupsd/apccontrol. Consequently, the CONTROL configuration statement is obsolete. The following configuration statements have been replaced by scripts called from SYSCONDFIR/apcupsd/apccontrol, and thus are obsolete: BATTCMD, LIMITCMN, LOADCMD, PWRCMD, REBOOTCMD, REMOTECMD, RETCMD, and TIMECMD. If you use the master/slave networking code, please be aware that the @ text @d1 1 a1 1 $NetBSD: patch-ad,v 1.2 2000/08/05 07:31:18 jlam Exp $ d3 150 a152 64 --- 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 @ 1.2 log @Update apcupsd to 3.6.2. Package provided by Greg Woods in pkg/10552. Changes from version 3.5.8: Network is fully functional under non-threaded compile. Possible fix for "pipe_master_status" calls on slaves. Added 940-1524C smart signal cable support. Added internationalization support. There is _only_ the support but no current code is written for the intl package. It can be compiled in, but intl strings have still to be translated (to be done in the future). Added new configuration options to reduce init time of daemon. powersc CONFIG powersc NAME powersc BATTERY Fixes a FIFO error @ text @d1 1 a1 1 $NetBSD$ d3 64 a66 99 --- installs/powersc.in.orig Thu Jul 29 03:46:32 1999 +++ installs/powersc.in Sat Aug 5 02:52:40 2000 @@@@ -26,66 +26,68 @@@@ case "$1" in POWEROUT) printf "Warning! There are power problems." | $WALL + /usr/bin/logger -p user.info -t powersc "Warning there are Power problems." ;; ONBATTERY) printf "Power Failure! Running on UPS." | $WALL + /usr/bin/logger -p user.info -t powersc "Power Failure! Running on UPS." ;; FAILING) - printf "Battery Power Failed -- Normal Shutdown.\n" | $WALL + printf "Battery power failed -- Normal shutdown.\n" | $WALL + /usr/bin/logger -p user.info -t powersc "Battery power failed -- Normal shutdown." ;; TIMEOUT) printf "On-line battery timeout -- Normal Shutdown.\n" | $WALL + /usr/bin/logger -p user.info -t powersc "On-line battery timeout -- Normal Shutdown." ;; LOADLIMIT) printf "Battery load limits reached -- Normal Shutdown.\n" | $WALL + /usr/bin/logger -p user.info -t powersc "Battery load limits reached -- Normal Shutdown." ;; RUNLIMIT) printf "Battery run time limits reached -- Normal Shutdown.\n" | $WALL + /usr/bin/logger -p user.info -t powersc "Battery run time limits reached -- Normal Shutdown." ;; DOSHUTDOWN) - printf "Beginning Shutdown Sequence!" | $WALL - ps x | gawk '{ if (($5 == "init") && ($1 == "1")) print $6 }' \ - | cut -f2 -d[ | cut -f1 -d] \ - > /tmp/run.level.power if [ -f $POWERPID ] then exit 0 else echo $$ > $POWERPID - $SHUTDOWN -h now + $SHUTDOWN -h now "$0: beginning normal UPS initiated shutdown..." fi ;; MAINSBACK | WAITASEC) printf "Power has returned." | $WALL + /usr/bin/logger -p user.info -t powersc "Power has returned." if [ -f $POWERPID ]; then printf "Attempting to cancel shutdown." | $WALL + /usr/bin/logger -p user.info -t powersc "Attempting to cancel shutdown." kill $(cat $POWERPID) rm -f $POWERPID - init $(cat /tmp/run.level.power) fi ;; ANNOYME) - printf "Power Problems! Please Log Off Now!" | $WALL + printf "Power Problems! Please logout now!" | $WALL + /usr/bin/logger -p user.info -t powersc "Power Problems! Please logout now!" ;; EMERGENCY) - printf "Possible battery failure -- Emergency Shutdown!" | $WALL - $SHUTDOWN -h now + $SHUTDOWN -h now "$0: Emergency shutdown, UPS Batteries have failed" ;; CHANGEME) - printf "Emergency -- Batteries Have Failed!\nChange Them NOW!" | $WALL + printf "Emergency -- Batteries have failed!\nChange them as soon as possible!" | $WALL + /usr/bin/logger -p user.info -t powersc "Emergency -- Batteries have failed! Change them as soon as possible!" ;; REMOTE) - printf "Remote Calls -- Normal Shutdown.\nBeginning Shutdown Sequence!" | $WALL - $SHUTDOWN -h now + $SHUTDOWN -h now "Remote UPS calls -- Normal shutdown. Beginning shutdown sequence!" ;; KILL) sleep 1 $APCUPSD killpower sleep 10 ;; INIT) rm -f $POWERPID - rm -f /etc/powerfail - rm -f /etc/powerstatus - rm -f /etc/nologin + rm -f /var/run/powerfail + rm -f /var/run/apcupsd.status [ "$2" = "" ] && echo -n "Starting APCUPSD Power Management: " $APCUPSD [ "$2" = "" ] && echo "apcupsd" @@@@ -103,9 +105,8 @@@@ kill $(cat $APCPID) rm -f $APCPID rm -f $POWERPID - rm -f /etc/powerfail - rm -f /etc/powerstatus - rm -f /etc/nologin + rm -f /var/run/powerfail + rm -f /var/run/apcupsd.status sleep 10 $APCUPSD [ "$2" = "" ] && echo "apcupsd" @ 1.1 log @Initial revision @ text @d1 1 a1 1 $NetBSD: $ d3 99 a101 12 --- apcreports.c Wed Apr 7 18:06:41 1999 +++ apcreports.c Sun Jul 18 19:48:17 1999 @@@@ -58,7 +58,9 @@@@ #include #include +#ifndef __NetBSD__ #include +#endif /* __NetBSD__ */ #include #include #include @ 1.1.1.1 log @apcupsd, a daemon to manage and monitor APC UPSes. @ text @@