Gentoo Archives: gentoo-user

From: Walter Dnes <waltdnes@××××××××.org>
To: Gentoo Users List <gentoo-user@l.g.o>
Subject: [gentoo-user] apcupsd settings for hibernate+shutdown?
Date: Wed, 16 Jan 2013 00:24:08
Message-Id: 20130116002327.GA23536@waltdnes.org
1 I'm running an APC UPS on Gentoo linux (Back-UPS XS 1300G). Up till
2 now, I've used the UPS in "dumb" mode; i.e. no acpusd running. My main
3 concern has been short power blips, and under/over-voltage. All I
4 wanted was a few minutes to shut down or hibernate the PC before the
5 battery gave out. I've enabled the "Master/Controlled outlets" feature.
6 I have the PC plugged into the Master, and a surgeprotector powerbar
7 into a Controlled outlet. The monitor/speakers/modem/etc are plugged
8 into the surgeprotector. When I manually hibernate the PC, the ups cuts
9 off power to the peripherals connected to the surgeprotector (connected
10 to the "Controlled outlet").
11
12 I may be getting a contract soon that involves crunching huge text
13 files, with multi-hour overnight data runs, etc. I'll launch a run, and
14 leave things unattended for hours on end. Let's assume I start a run,
15 go away for the day, and a power outage hits. My Google searches always
16 seem to turn up hits involving sending warning messages to users that
17 the system may be going down soon. What I actually want to happen in an
18 extended power outage is...
19
20 * have the system execute the command "/usr/sbin/hibernate" to save
21 program state, etc to disk, and then shut down.
22
23 * shut down the APC ups afterwards.
24
25 Note that once "/usr/sbin/hibernate" is launched, you have to assume
26 that the ups immediately loses contact with the PC, ***BUT THE UPS MUST
27 STAY ON FOR A COUPLE OF MINUTES AFTERWARD*** to give the PC time to shut
28 down gracefully. Will "KILLDELAY 180" give 3 minutes safety margin?
29 And what do I have to do to get it to execute "/usr/sbin/hibernate"? As
30 per instructions from the install, I've done...
31
32 rc-update add apcupsd.powerfail shutdown
33
34 ...which is supposed to tell the ups to shut down when the PC shuts down.
35 Colour me confused...
36
37 * does the ups not shut itself down due to BATTERYLEVEL/MINUTES/TIMEOUT?
38 * if so, why does it need the "apcupsd.powerfail" service in my PC's
39 shutdown runlevel?
40
41 Here are my config file and apcaccess status output...
42
43 *** /etc/apcupsd/apcupsd.conf file ***
44 UPSCABLE usb
45 UPSTYPE usb
46 LOCKFILE /var/lock
47 SCRIPTDIR /etc/apcupsd
48 PWRFAILDIR /etc/apcupsd
49 NOLOGINDIR /etc
50 ONBATTERYDELAY 6
51 BATTERYLEVEL 15
52 MINUTES 5
53 TIMEOUT 0
54 ANNOY 300
55 ANNOYDELAY 60
56 NOLOGON disable
57 KILLDELAY 180
58 NETSERVER on
59 NISIP 0.0.0.0
60 NISPORT 3551
61 EVENTSFILE /var/log/apcupsd.events
62 EVENTSFILEMAX 10
63 UPSCLASS standalone
64 UPSMODE disable
65 STATTIME 0
66 STATFILE /var/log/apcupsd.status
67 LOGSTATS off
68 DATATIME 0
69
70 *** apcaccess status ***
71 APC : 001,037,0914
72 DATE : 2013-01-13 03:17:56 -0500
73 HOSTNAME : d531
74 VERSION : 3.14.8 (16 January 2010) gentoo
75 UPSNAME : d531
76 CABLE : USB Cable
77 MODEL : Back-UPS XS 1300G
78 UPSMODE : Stand Alone
79 STARTTIME: 2013-01-13 03:15:05 -0500
80 STATUS : ONLINE
81 LINEV : 122.0 Volts
82 LOADPCT : 7.0 Percent Load Capacity
83 BCHARGE : 100.0 Percent
84 TIMELEFT : 60.0 Minutes
85 MBATTCHG : 15 Percent
86 MINTIMEL : 5 Minutes
87 MAXTIME : 0 Seconds
88 SENSE : High
89 LOTRANS : 088.0 Volts
90 HITRANS : 136.0 Volts
91 ALARMDEL : Always
92 BATTV : 27.2 Volts
93 LASTXFER : No transfers since turnon
94 NUMXFERS : 0
95 TONBATT : 0 seconds
96 CUMONBATT: 0 seconds
97 XOFFBATT : N/A
98 SELFTEST : NO
99 STATFLAG : 0x07000008 Status Flag
100 MANDATE : 2012-07-06
101 SERIALNO : [ deleted ]
102 BATTDATE : 2012-07-06
103 NOMINV : 120 Volts
104 NOMBATTV : 24.0 Volts
105 NOMPOWER : 780 Watts
106 FIRMWARE : 864.L6 .D USB FW:L6
107 APCMODEL : Back-UPS XS 1300G
108 END APC : 2013-01-13 03:17:56 -0500
109
110 --
111 Walter Dnes <waltdnes@××××××××.org>
112 I don't run "desktop environments"; I run useful applications