Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Sep 2002 19:03:35 +0300
From:      Petri Riihikallio <Petri.Riihikallio@Metis.fi>
To:        David =?iso-8859-1?Q?Sieb=F6rger?= <drs@rucus.ru.ac.za>, questions@FreeBSD.ORG
Subject:   Re: How to shut down cleanly by killing power
Message-ID:  <a05111b05b9ba2942ec3e@[192.168.0.2]>
In-Reply-To: <20020927151424.GA430@rucus.ru.ac.za>
References:  <a05111b01b9b9ea46ac33@[192.168.0.2]> <20020927151424.GA430@rucus.ru.ac.za>

next in thread | previous in thread | raw e-mail | index | archive | help
>The way I've set it up, upsmon (part of NUT) issues a 'shutdown -p'
>when the battery is low.  A local hack to rc.shutdown then instructs
>the UPS to turn itself off a few seconds later, by running:
>
>     /usr/local/libexec/nut/newapc -a su1000 -k -d 3
>
>In the scenario you describe, things would work like this:
>
>  - mains power fails, and the UPS runs on battery power
>  - eventually, the battery runs low
>  - upsmon starts the shutdown process
>  - rc.shutdown tells the UPS to turn itself off
>  - the PC turns itself off
>  - some seconds later, the UPS shuts down as instructed, without
>    draining its battery
>  - mains power is restored
>  - the UPS notices that power is restored, powers up again, and the
>    PC boots
>
>There is still a short period during which deadlock could occur
>(between the PC shutting down and the UPS shutting down), but this is
>far shorter than the time between the PC shutting down and UPS
>draining its battery.

Darn! You have a better UPS than I! :-(

You have an APC "smart" model, I have a dumb one. The smart ones have 
a "shutdown grace period". That is, they don't kill the power 
immediately after the -k command, but after a delay. That -d 3 should 
make it 3 seconds, which is kind of short. The default delay is 20 
seconds. If there are no stuck processes, it should be OK. You could 
increase the delay to 60 seconds to be sure that the system is 
lifeless.

You shouldn't have any fear of the deadlock, since the smart APC 
UPSes obey the killpower command even if the power returns. It is 
just the dumb ones to worry about.

Using the shutdown grace period is one way to circumvent the problem. 
It is documented in the NUT docs. I don't have that option and that's 
why I am trying to make the system ready to power off.

Beware of the clueless salesmen! The salesperson who sold me the 
UPSes wouldn't understand the problem even if he tried to. And I 
thought I was bright when I cleared the VA, W, Ah, 
stand-by/line-interactive/double-conversion mess!
-- 
Cheers,
Petri

Metis / Petri Riihikallio
GSM: +358 400 505 939

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a05111b05b9ba2942ec3e>