[Nut-upsuser] CyberPower Value 2200E-GP
David Varley
davidavarley at gmail.com
Fri Dec 17 22:58:34 UTC 2010
On Fri, 17 Dec 2010 17:41:39 +0100, Arjen de Korte
<nut+users at de-korte.org<nut%2Busers at de-korte.org>
> wrote:
>
>
> Citeren David Varley <davidavarley at gmail.com>:
>
> As far as setting the shutdown command in a script run when hibernating, I
>> did this. I created a script, 48nut, in /etc/pm/sleep.d, as follows:
>>
>> #!/bin/sh
>> # If we are hibernating due to power-fail, initiate a delayed UPS shutdown
>> and then stop the nut services
>> # If we are thawing after this event, start the nut service
>> # DAV 17DEC10
>>
>> if (test -f /etc/killpower)
>> then
>> case "$1" in
>> hibernate|suspend)
>> echo "Initiating UPS Powerdown Sequence"
>> /sbin/upsdrvctl shutdown
>> echo "Stopping nut service"
>> service nut stop
>>
>
> This won't work. In order to send a poweroff command to the UPS, the
> drivers must be restarted from scratch. Therefor you must run 'service nut
> stop' before doing that, otherwise the backgrounded drivers will not have
> exited.
>
> It also is a good idea to put a 'sleep 2' between the two commands, to give
> the drivers some time to respond to the KILL signal they receive:
>
> echo "Stopping nut service"
> service nut stop
> sleep 2
> echo "Initiating UPS Powerdown Sequence"
> /sbin/upsdrvctl shutdown
>
> Best regards, Arjen
>
Arjen, now I'm a bit confused. In your script you are saying to shut down
nut before issuing the upsdrvctl command to tell the UPS to start a delayed
shutdown. But as shutting down nut causes the usbhid-ups driver to exit, I
thought that would prevent the command being sent to the UPS? I know that if
I just have the upsdrvctl shutdown command without telling the nut service
to exit, the UPS shuts down after the 60 second delay. I can understand
adding the delay after giving the shutdown command and before stopping the
services, but not the other way around. What am I missing here?
Thanks, David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20101218/a574b6c0/attachment.htm>
More information about the Nut-upsuser
mailing list