[Ma-linux] Re: [Novalug] Need help: Need to build Apcupsd on a FreeBSD 6.2 box

donjr djr1952 at hotpop.com
Thu Jul 12 13:15:15 EDT 2007


On Thu, 2007-07-12 at 11:12 -0400, Ed T. Toton III wrote:

> Do you want them to power off immediately when the power goes down, or 
> allow them to ride out shorter power losses?
> 
> I don't have mine doing any remote shutdowns as such, but I have a box 
> that only powers down if the mains are down for a full 3 minutes (the UPS 
> will run my rack for over 20 minutes, longer with a couple machines turned 
> off). I added a line ("/root/start-shutdown &") to the 
> /etc/apcupsd/onbattery script, and the shutdown script contains:
> 
> #!/bin/bash
> sleep 180
> /sbin/poweroff &
> 
> Then I also added "/usr/bin/killall start-shutdown" to the 
> /etc/apcupsd/mainsback script to abort the shutdown if the power returns 
> before the 3 minutes are up.
> 

Why didn't you just use this instead:

  #!/bin/sh
  exec /sbin/shutdown -P +3 "system will power off in three minutes from now" &


If power comes up before the three minutes expires all you have to
arrange to happen is the sending of:
  /sbin/shutdown -c "Power has been restored..."

  { see "man shutdown" the '-c' means cancel ... :-}

If 'shutdown -P' doesn't power off your system then you need to adjust
the shutdown subsystem.

--  
-- 
 Don E. Groves, Jr. 

$ /usr/games/fortune : 
The holy passion of Friendship is of so sweet and steady and loyal and
enduring a nature that it will last through a whole lifetime, if not
asked to lend money.
  -- Mark Twain, "Pudd'nhead Wilson's Calendar"



More information about the Ma-linux mailing list