[Nut-upsdev] Initialising UPS variables from ups.conf

John Bayly freebsd.ports at tipstrade.net
Mon Mar 7 12:35:00 UTC 2011


On 07/03/2011 11:42, Arjen de Korte wrote:
> Citeren John Bayly <freebsd.ports at tipstrade.net>:
>
>> Are there any plans to allow us to specify UPS variables in ups.conf,
>> eg:
>
> We already support this (as a hidden feature) since nut-2.4.0, where
> it is possible to set
>
>     default.<variable> = value (default to value if UPS doesn't report
> this)
>     override.<variable> = value (same, but override if reported by UPS)
>
> But most likely, this is not what you need.
I'll look into how that works, thanks. These look like they do exactly 
the job for specifying the delays for the switched outlets 
(outlet.1.delay.start). Is there any reason why they're a "hidden 
feature"? Should I rely on this remaining? Is it driver specific?
>
> You probably missed the man page for the usbhid-ups driver. See
> 'offdelay' and 'ondelay' under EXTRA ARGUMENTS in 'man 8 usbhid-ups'
> which are meant to do what you want. Using the
> '(default|override).ups.delay.(start|shutdown)' mechanism might also
> work, but this is not recommended.
Face-palm, how on earth did I miss that?
>
>> The reason I ask is that I'm using FreeBSD & gmirror and need to
>> extend the gracetime for the system to shutdown. For the moment, I've
>> created a custom shutdown script that is set in upsmon.conf that does
>> the job.
>
> I doubt it.
Yup, but for reasons below
>> #!/usr/local/bin/bash
>>
>> /usr/local/bin/upsrw -s ups.delay.start=130 -u haltuser -p
>> somepassword evo_s_3000
>> /usr/local/bin/upsrw -s ups.delay.shutdown=120 -u haltuser -p
>> somepassword evo_s_3000
>>
>> /sbin/shutdown -h +0
>
> This most likely doesn't work, since the changed values of
> 'ups.delay.start' and 'ups.delay.shutdown' won't stick between
> invocations of the driver. Only if you keep the driver running and
> send the instcmd 'shutdown.return' this might work, but this is not
> what happens if you call 'upsdrvctl shutdown' (where the driver is
> restarted with the -k flag). You *must* use ondelay and offdelay instead.
I discovered that about the values not "sticking". To work around this, 
instead of issuing `upsdrvctl shutdown`, I've been issuing the 
`shutdown.return` command. I imagine your head has now slammed into your 
desk upon hearing this :-)
As it is, my setup wasn't ideal, but works exactly as desired (Client & 
Master halt, UPS shuts down and comes up no sooner that 10s afterwards, 
systems restart when AC is restored).

>
> Best regards, Arjen
I appreciate you clearing things up.

Thanks,
John

Sorry, forgot to reply to the list too <sigh>





More information about the Nut-upsdev mailing list