#381288 [feature request] hibernate instead of shutdown

Package:
apcupsd
Source:
apcupsd
Description:
APC UPS Power Management (daemon)
Submitter:
Luca Bigliardi
Date:
2010-03-10 21:21:07 UTC
Severity:
normal
#381288#5
Date:
2006-08-03 12:27:10 UTC
From:
To:
I think that can be useful add support for hibernate.

For example in my workstation i have software suspend 2 and hibernate
configured, so i've made an ugly hack to /etc/apcupsd/apccontrol :
--- apccontrol_ORIG     2006-08-03 14:04:19.000000000 +0200
+++ apccontrol  2006-08-03 14:05:51.000000000 +0200
@@ -21,6 +21,7 @@
 APCPID=/var/run/apcupsd.pid
 APCUPSD=/sbin/apcupsd
 SHUTDOWN=/sbin/shutdown
+HIBERNATE=/usr/sbin/hibernate
 SCRIPTSHELL=/bin/sh
 SCRIPTDIR=/etc/apcupsd
 WALL=wall
@@ -105,7 +106,7 @@
     ;;
     doshutdown)
        echo "UPS ${2} initiated Shutdown Sequence" | ${WALL}
-       ${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown"
+       ${HIBERNATE}
     ;;
     annoyme)
        echo "Power problems with UPS ${2}. Please logoff." | ${WALL}


Maybe a proper implementation is to have a "dohibernate" to call if a
flag in apcupsd.conf is set.


TIA for your attention

luca

#381288#10
Date:
2006-08-08 12:41:21 UTC
From:
To:
I don't think it is appropriate to configure hibernate via apcupsd.conf.
There are dozens of different things users might want to do in response
to various events and this is why the event handling in Apcupsd is
entirely scriptable. If we were to try to anticipate every user's needs
in apcupsd.conf that file would quickly become unmanageable.

The correct way to implement the hibernate change you made is to create
a script named "doshutdown" and place it in the same directory as
apccontrol. That script will be automatically called by apccontrol when
a doshutdown event ocurrs and you can perform any actions you want.
Return with exit code 99 and apccontrol will skip the default action
for that event so your script has complete control. This is all
documented in comments in the apccontrol script and in the apcupsd user
manual.

#381288#17
Date:
2010-03-10 21:11:27 UTC
From:
To:
Quoting Adam Kropelin <akropel1@rochester.rr.com>:
"I don't think it is appropriate to configure hibernate via apcupsd.conf."

I think the proper way to implement this it is irrelevant to the end-user.

Facts are that
a) there is user request for this feature (+1 vote from me)
b) the bug reporter has provided a  working patch (even if the
implementation is questionable)

I think it is more important that the feature be taken into account
(ex. "patches welcome!, hint: do it this way") than arguing "nah, I
don't think is ok"

PS: just as I was preparing to send this email, I've had the first
power outage since I bought my UPS last week. Luckyly this draft was
in gmail, but other ton of opened apps were local - I think I saved my
nervous system by changing 'shutdown' to 'hibernate'. because if i had
shutdown, the display wasn't yet connected to the ups -haven't time to
do so (yet another reason in favor of hibernate - keep only pc unit to
prolong the on-battery time...) - so i couldn't make quick saves.

#381288#22
Date:
2010-03-10 21:20:09 UTC
From:
To:
note that i am talking about adding an optional action and not
changing the default action, which is quite different than the bug
title.