LinHES Forums
http://forum.linhes.org/

Automated APC UPS setup script
http://forum.linhes.org/viewtopic.php?f=3&t=16292
Page 2 of 2

Author:  jmckeown2 [ Sat Sep 15, 2007 3:36 pm ]
Post subject: 

tjc wrote:
BTW - Does the RRD script to monitor a UPS work with the status output of your unit?

It looks fine. I'll let you know if it seems wrong when I have more than a half-hour of data. I may try yanking the plug to see the charge drop...

Author:  fra [ Mon Oct 08, 2007 2:08 am ]
Post subject:  apcupsd, reboot, and wakeup!!

Nice script, tjc. Thanks!
apcupsd worked perfectly. Shutdown my box nicely during a simulated power failure.

However, I'd like to also set the system to wakeup to record and to run mythfilldatabase (and maybe to wake on lan.. not sure yet about this one).

The question is then: if the box is powered off by apcupsd and then the power is back and it is then time to record... will the system simply wake up?
or do i have to change /etc/init.d/halt as directed on apcupsd's manual, so that right before the system shuts down (during a power failure), apcupsd is reran with the --killpower option??

See
http://www.apcupsd.org/manual/After_Ins ... 0000000000
http://www.apcupsd.org/manual/Shutown_S ... 003c1_003e

How do these two things play together?? For instance:

a) If apcupsd is set to reboot the system after power comes back AND I set the box to wake up for recording, then will there be a problem if there's no power yet but it is time to record??? Or do the two procedures work differently and they don't contradict each other?

b) Do I or do I not need to make apcupsd reboot the pc after power comes back? And if I do need to make it reboot, then which way? The BIOS way, by editing halt, or by changing "poweroff" to "halt" in /etc/default/halt, or something else???

Thanks for shedding any light on this issue!!!

EDIT: If I'm using http://www.knoppmythwiki.org/index.php? ... ythWelcome to make the box wake up to record, then it SEEMS the halt command is what shuts the system down. If I'm right and it IS the same halt command apcupsd uses to power the machine off, then I shouldn't really do anything! (or is it halt -p for nvram verses halt for upcusbd???) Am I correct that if I just install apcupsd with tjc's script and then follow that wiki and make the system wake up to record (maybe changing halt -p to just halt in nvram's settings in myth-setup??) then I'll have the following behavior?

a) with power not interrupted, the system shuts down when idle
b) with power being interrupted, the system also shuts down
c) while the machine is off (whether due to idling or power outage), if the power comes back nothing happens.. power goes off again.. still nothing happens.. and so on!
d) while the system is down (whether due to idling or power outage), if it is time to record the system tries to wake up
d1) if the battery has shut itself off, the system will not be able to reboot
d2) if the power is on, the system will wake up

that would be ideal! but is it how it really would work???

the only problem is if power goes off, the battery shuts the system down, and before the battery turns off a recording says the system should wake up! then during the boot process, the battery will power the system off!!!
i guess this can be avoided by setting a small grace period, decreasing the chance of this situation occurring. can anyone see a problem with a small grace period?

btw, the KM default is 20 seconds while apcupsd's default is 180 seconds. is this behavior the reason for having the smaller default in KM??!!

and what happens if while the system is powering up, the power goes off!! i guess the battery waits till the system is up and running, then starts doing its magic? [i'd think that's how it SHOULD work!]

Thanks for any answers to any of these questions!!!!

Author:  fra [ Tue Oct 09, 2007 4:10 pm ]
Post subject: 

OK let me make a shorter and less intimidating post with only two questions :) :)

I have setup the box to wake on recordings using ACPI and MythWelcome.

Do I understand correctly that the system simply shuts down whether
a. asked by apcupsd (due to power failure)
or
b. asked to do so due to idling
???

If this is true, then whenever it is supposed to wake up (if a recording is coming up), it will attempt to wake up whether it shut down due to a or to b above.

If there is power, it will wake up and record.... If there isn't it will not be able to wake up.

The only issue I see is if the battery instructs the system to shutdown and after it shuts down and the battery hasn't powered off yet, a recording comes up and the system starts waking up. The battery will then power it off! I'm guessing this can be solved by setting a small grace period for the ups to shut down after the system has. Any problems with that???

EDIT: OK one more MAJOR issue. if the ups shuts the system down, the system will not know when to wake up for the next recording!!! so i MUST make the system come back once power is restored. i guess i can set it up so that it does not go automatically to the frontend but rather always go to mythwelcome. this way, it comes back, becomes idle, shuts back down, but now it knows when to wake up next.

Comments? Thoughts?

Author:  ghede [ Sat Jan 05, 2008 5:26 pm ]
Post subject:  Thanks for the Script !!

As you can see from the log, we had some power problems yesterday. Power was out for 23 hrs. Leading up to the big outage there certainly was some activity on the power line. And it looks like it may be continuing today. More bad weather is expected here in Monterey, CA. Just want to say thanks, you may have have saved my box !!

Ghede


Thu Oct 18 20:10:18 PDT 2007 apcupsd 3.12.4 (19 August 2006) debian startup succeeded
Fri Oct 26 06:19:48 PDT 2007 UPS Self Test switch to battery.
Fri Oct 26 06:19:56 PDT 2007 UPS Self Test completed: Battery OK
Fri Nov 09 04:36:01 PST 2007 UPS Self Test switch to battery.
Fri Nov 09 04:36:09 PST 2007 UPS Self Test completed: Battery OK
Fri Nov 23 03:52:14 PST 2007 UPS Self Test switch to battery.
Fri Nov 23 03:52:22 PST 2007 UPS Self Test completed: Battery OK
Thu Nov 29 10:01:31 PST 2007 Power failure.
Thu Nov 29 10:01:33 PST 2007 Power is back. UPS running on mains.
Mon Dec 10 13:49:34 PST 2007 Power failure.
Mon Dec 10 13:49:36 PST 2007 Power is back. UPS running on mains.
Sat Dec 15 12:59:23 PST 2007 Power failure.
Sat Dec 15 12:59:25 PST 2007 Power is back. UPS running on mains.
Sat Dec 15 12:59:44 PST 2007 Power failure.
Sat Dec 15 12:59:46 PST 2007 Power is back. UPS running on mains.
Sat Dec 29 12:15:48 PST 2007 UPS Self Test switch to battery.
Sat Dec 29 12:15:57 PST 2007 UPS Self Test completed: Battery OK
Fri Jan 04 06:34:43 PST 2008 Power failure.
Fri Jan 04 06:34:44 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 06:34:50 PST 2008 Power failure.
Fri Jan 04 06:34:51 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 06:35:16 PST 2008 Power failure.
Fri Jan 04 06:35:18 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 06:49:47 PST 2008 Power failure.
Fri Jan 04 06:49:48 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 06:50:57 PST 2008 Power failure.
Fri Jan 04 06:50:58 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 06:56:00 PST 2008 Power failure.
Fri Jan 04 06:56:02 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 06:58:41 PST 2008 Power failure.
Fri Jan 04 06:58:42 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 07:27:49 PST 2008 Power failure.
Fri Jan 04 07:27:50 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 07:42:34 PST 2008 Power failure.
Fri Jan 04 07:42:36 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 07:54:17 PST 2008 Power failure.
Fri Jan 04 07:54:19 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 08:29:58 PST 2008 Power failure.
Fri Jan 04 08:30:00 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 08:36:23 PST 2008 Power failure.
Fri Jan 04 08:36:25 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 08:51:26 PST 2008 Power failure.
Fri Jan 04 08:51:30 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 08:51:33 PST 2008 Power failure.
Fri Jan 04 08:51:35 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 08:55:06 PST 2008 Power failure.
Fri Jan 04 08:55:06 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 08:55:06 PST 2008 Power failure.
Fri Jan 04 08:55:07 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 09:10:30 PST 2008 Power failure.
Fri Jan 04 09:10:32 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:18:13 PST 2008 Power failure.
Fri Jan 04 10:18:14 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:18:23 PST 2008 Power failure.
Fri Jan 04 10:18:24 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:23:08 PST 2008 Power failure.
Fri Jan 04 10:23:10 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:23:55 PST 2008 Power failure.
Fri Jan 04 10:23:57 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:26:13 PST 2008 Power failure.
Fri Jan 04 10:26:15 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:28:33 PST 2008 Power failure.
Fri Jan 04 10:28:35 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:28:57 PST 2008 Power failure.
Fri Jan 04 10:28:59 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:38:55 PST 2008 Power failure.
Fri Jan 04 10:38:57 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:39:01 PST 2008 Power failure.
Fri Jan 04 10:39:03 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:42:11 PST 2008 Power failure.
Fri Jan 04 10:42:13 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:42:17 PST 2008 Power failure.
Fri Jan 04 10:42:19 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:43:14 PST 2008 Power failure.
Fri Jan 04 10:43:16 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:43:23 PST 2008 Power failure.
Fri Jan 04 10:43:25 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:43:47 PST 2008 Power failure.
Fri Jan 04 10:43:49 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:48:01 PST 2008 Power failure.
Fri Jan 04 10:48:03 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:48:07 PST 2008 Power failure.
Fri Jan 04 10:48:09 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:48:27 PST 2008 Power failure.
Fri Jan 04 10:48:29 PST 2008 Power is back. UPS running on mains.
Fri Jan 04 10:53:18 PST 2008 Power failure.
Fri Jan 04 10:53:24 PST 2008 Running on UPS batteries.
Fri Jan 04 12:06:00 PST 2008 Battery power exhausted.
Fri Jan 04 12:06:00 PST 2008 Initiating system shutdown!
Fri Jan 04 12:06:00 PST 2008 User logins prohibited
Fri Jan 04 12:06:01 PST 2008 apcupsd exiting, signal 15
Fri Jan 04 12:06:01 PST 2008 apcupsd shutdown succeeded
Sat Jan 05 13:40:19 PST 2008 apcupsd 3.12.4 (19 August 2006) debian startup succeeded
Sat Jan 05 13:54:06 PST 2008 Power failure.
Sat Jan 05 13:54:08 PST 2008 Power is back. UPS running on mains.
Sat Jan 05 14:04:00 PST 2008 Power failure.
Sat Jan 05 14:04:01 PST 2008 Power is back. UPS running on mains.

Page 2 of 2 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/