[CentOS] 2 questions re UPS management

Tue Mar 19 22:31:14 UTC 2013
Fred Smith <fredex at fcshome.stoneham.ma.us>

On Tue, Mar 19, 2013 at 01:55:11PM -0700, Craig White wrote:
> 
> 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 originally did that (I think my original posting mentioned that) without
the backslashes, but when run it got an error message about line too long
or something similar, so that's why I tried making it an external script.

Ah, I see you used "&&" whereas I just used a semicolon separator.
wonder if it would make any difference.... (I understand that the "&&"
causes the second command to be skipped if the first one fails, while
the semicolon keeps it as two independent commands.)

I don't expect to be back there til Monday, but I'll try some of these
variants when I get there. (I could VPN in and try it, but if something
goes haywire, then I'm scrod for remote access.)

-- 
---- Fred Smith -- fredex at fcshome.stoneham.ma.us -----------------------------
                        The Lord is like a strong tower. 
             Those who do what is right can run to him for safety.
--------------------------- Proverbs 18:10 (niv) -----------------------------