Aug 9 07:01:20 Scott apcupsd[6464]: Power failure. Aug 9 07:01:20 Scott apcupsd[6464]: Reached remaining time percentage limit on batteries. Aug 9 07:01:20 Scott apcupsd[6464]: Initiating system shutdown! Aug 9 07:01:20 Scott apcupsd[6464]: User logins prohibited Aug 9 07:01:20 Scott wall[29630]: wall: user root broadcasted 1 lines (68 chars ) Aug 9 07:01:20 Scott wall[29633]: wall: user root broadcasted 1 lines (38 chars ) Aug 9 07:01:21 Scott apcupsd[6464]: Cancelling shutdown Aug 9 07:01:21 Scott apcupsd[6464]: Power is back. UPS running on mains. Aug 9 07:01:21 Scott apcupsd[6464]: Allowing logins Aug 9 07:01:24 Scott init: Switching to runlevel: 0 Aug 9 07:01:35 Scott apcupsd[6464]: apcupsd exiting, signal 15 Aug 9 07:01:35 Scott apcupsd[6464]: apcupsd shutdown succeeded Power burp at :20, shutdown cancelled at :21, init continues to shut down at :24, and kills apcupsd at :35. This means my system shuts down one or more times a day now :<
Suggestions how to fix this one?
Ok, here's some more digging. I added "shutdown -c" to the apccontrol file, gee, that might come in handy ya think? Due to a brilliant move on shutdown's part, it deletes it's pid file thus nobody can cancel the running shutdown. (filtered copy) 9301 sendto(5, "<25>Jan 14 08:15:40 apcupsd[9301]: Initiating system shutdown!\0", 63, 0, NULL, 0 <unfinished ...> [...] 789 execve("/sbin/shutdown", ["/sbin/shutdown", "-t", "15", "-h", "now", "apcupsd UPS BL-APC1 initiated shutdown"], [/* 21 vars */] <unfinished ...> 789 open("/var/run/shutdown.pid", O_RDONLY) = -1 ENOENT (No such file or directory) 789 unlink("/var/run/shutdown.pid") = -1 ENOENT (No such file or directory) 789 open("/var/run/shutdown.pid", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5 789 unlink("/var/run/shutdown.pid") = 0 ouch! boy that's brilliant i say... 9301 sendto(5, "<25>Jan 14 08:15:43 apcupsd[9301]: Cancelling shutdown\0", 55, 0, NULL, 0) = 55 951 execve("/sbin/shutdown", ["/sbin/shutdown", "-c", "Cancelling shutdown command"], [/* 21vars */] <unfinished ...> 951 open("/var/run/shutdown.pid", O_RDONLY <unfinished ...> 951 write(2, "shutdown: cannot find pid of running shutdown.\n", 47 <unfinished ...> now whodahthunk we might want to cancel a shutdown?
Here's a temporary fix. While it dances with danger a bit more due to the delay introduced. At least it provides us with the opportunity to interrupt the shutdown process. On a side note, we need a means to return to the point we were running at when the shutdown was requested. I.e. restart stopped processes. Scott apcupsd # diff -ruN apccontrol.orig apccontrol --- apccontrol.orig 2005-01-14 08:39:48.000000000 -0500 +++ apccontrol 2005-01-14 08:41:07.000000000 -0500 @@ -85,6 +85,9 @@ echo "Power has returned on UPS ${2}..." | ${WALL} if [ -f /etc/apcupsd/powerfail ] ; then printf "Continuing with shutdown." | ${WALL} + else + echo "Cancelling shutdown command" | ${WALL} + ${SHUTDOWN} -c "Cancelling shutdown command" fi ;; failing) @@ -105,7 +108,7 @@ ;; doshutdown) echo "UPS ${2} initiated Shutdown Sequence" | ${WALL} - ${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown" + ${SHUTDOWN} -h +1 "apcupsd UPS ${2} initiated shutdown" ;; annoyme) echo "Power problems with UPS ${2}. Please logoff." | ${WALL}
FYI, a couple of notes: 1. This is a FAQ <http://www.sibbald.com/apcupsd/3.10.x-manual/Frequently_002dAsked-Questions.html>: "Normally, once the shutdown process has begun, we cannot stop it, though there is some code that tries to do so, we don't consider it a very good idea
FYI, a couple of notes: 1. This is a FAQ <http://www.sibbald.com/apcupsd/3.10.x-manual/Frequently_002dAsked-Questions.html>: "Normally, once the shutdown process has begun, we cannot stop it, though there is some code that tries to do so, we don't consider it a very good idea how do you stop a shutdown that has killed off half of the daemons running on your system? ..." 2. The -c flag to shutdown is for cancelling a delayed shutdown (as in "shutdown 3:00"). When apcupsd does a shutdown, it does a "shutdown now", which can't be canceled. 3. If your UPS immediately starts a shutdown after a power failure, it sounds like your battery is dead (or the UPS is overloaded). When was the last time you changed the battery? I'd say this is not a bug.
which is why i changed the shutdown to a 1 minute timer instead of immediate. my ups lasts a few minutes - yes, it's close to being overloaded. however it's very frustrating for a split second power burp to shutdown my system when i know it's perfectly fine for power to be out for that entire minute.
Closing this bug now. Thanks for your help.