Apcupsd smart sleep (delayed wakeup) patch
CAUTION
This patch is some sort of 'Quick Hack', it does NOT tested well. Take care for applying. And USB Signaling is NOT supported yet.
NEWS
- MAR 28, 2011 - Apcupsd smart sleep (delayed wakeup) patch 01 was posted.
REQUIREMENT FOR USE/BUILD
- Smart UPS ( must have serial interface, capability of sleep '@nnn' command )
- Smart Signaling serial cable ( APC Part# 940-0024C, # 940-0024D, 940-1524(black cable) or Interface Kit C (AP9824LJ) )
- Operating system supported by Apcupsd
- Apcupsd build environment ( build time only )
DOWNLOAD
- Smart patch 01 ( against apcupsd-3.14.8 )
- Download - From this site
- Download - From apcupsd-users Mail list archive
ABOUT THIS
After applying this patch, apcupsd darmon accept new option ( -s / --sleep ) and using instead of killpower ( -k / --killpower ), initiate '@nnn' command to your UPS.
# ./apcupsd --help
usage: apcupsd [options]
Options are as follows:
-b, don't go into background
-d, --debug <level> set debug level (>0)
-f, --config-file <file> load specified config file
-k, --killpower, --hibernate put UPS into hibernation mode [*]
-o, --power-off turn off UPS completely [*]
-P, --pid-file specify name of PID file
-p, --kill-on-powerfail hibernate UPS on powerfail
-R, put SmartUPS into dumb mode
-s, --sleep <minutes> put UPS into hibernation mode and
awake after <minutes> minutes[*]
-t, --term-on-powerfail terminate when battery power fails
-T send debug to ./apcupsd.trace
-V, --version display version info
-h, --help display this help
[*] Only one parameter of this kind and apcupsd must not already be running.
Copyright (C) 2004-2009 Adam Kropelin
Copyright (C) 1999-2005 Kern Sibbald
Copyright (C) 1996-1999 Andre Hedrick
Copyright (C) 1999-2001 Riccardo Facchetti
apcupsd is free software and comes with ABSOLUTELY NO WARRANTY
under the terms of the GNU General Public License
Report bugs to apcupsd Support Center:
apcupsd-users@lists.sourceforge.net
'@nnn' means 'delayed wakeup of nnn tenths of an hour', then argument of sleep ( -s / --sleep ) translate as follow;
For usual operation, it will be useful adding last of rc0 ( or similler ) script such as below;
if [ -f /path/to/sleep_minutes -a -x /path/to/apcupsd ] ; then
SLEEP_MINUTES=`cat /path/to/sleep_minutes`
echo
echo "APCUPSD make UPS asleep ${SLEEP_MINUTES} minutes..."
echo
/path/to/apcupsd --sleep ${SLEEP_MINUTES}
rm -f /path/to/sleep_minutes
fi
INSTALL
- Exrtact original apcupsd source archive
$ gzip -dc apcupsd-3.18.tar.gz | tar xf -
- Apply this patch
$ cd apc-upsd-3.18 ; gzip -dc /path/to/apcupsd-3.14.18-smsleep_01.patch.gz | patch -p 1
- Build as usual
configure , make , make install etc...
CHANGELOG
- MAR 28, 2011 - Apcupsd smart sleep (delayed wakeup) patch 01 was posted.
REFERENCES
- http://www.apcupsd.com/ - a daemon for controlling APC UPSes
- http://homepage1.nifty.com/Que/plamo/apc-ups/manual/upsbible.html - APC's smart protocol
AUTHOR
Hiroshi Chonan - chonan at pid0 dot org
LICENSE
This patch follows original Apcupsd's license policy. In other words, licensed under the GPL version 2.