[CentOS] 2 questions re UPS management

Tue Mar 19 20:55:11 UTC 2013
Craig White <craig.white at ttiltd.com>

On Mar 19, 2013, at 1:31 PM, Fred Smith wrote:

> On Tue, Mar 19, 2013 at 01:25:27PM -0700, Craig White wrote:
>> On Mar 19, 2013, at 9:44 AM, Fred Smith wrote:
>> 
>>> just to be sure I'm clear: the shutdown command appears to be sent
>>> to windows, as I desire. then instead of honoring the "+5" in the 
>>> local shutdown command it shuts down immediately.
>>> 
>>> but if I just run the identical script from a commandline it does
>>> exactly what I think it should: (1) tells windows to shut down then (2)
>>> waits 5 mins before shutting down Linux.
>> ----
>> sounds as if there is another daemon that is processing the signal from the UPS system and initiating the power down rendering the 5 minute wait in your script moot.
> 
> Well, factor this in, then:
> the original powerfail entry in inittab was the same as the shutdown
> command in my script EXCEPT for the lengthy command that makes windows
> shutdown.  It uses exactly the same "shutdown..." command, and as long
> as that command is inside inittab, when powerfail occurs, the pause
> also occurs.  only when I move it out to the external script does the
> pause fail to happen.
----
having the commands in an external script would fork a new process outside of the inittab so if it were me, I would simply join the commands to run as one within the inittab i.e..

/usr/bin/net rpc SHUTDOWN -C \
  "System shutting down NOW due to power failure" \
  -f -I 172.19.23.120 \
  -U <myusername>%<mypassword> && \
  /sbin/shutdown -f -h +5 \
  "Power Failure; System Shutting Down"

I can't see /bin/sh or /bin/bash making any difference in the outcome anyway.

Craig