[Nut-upsuser] Is a timer a file?

Arnaud Quette
Tue, 21 Mar 2017 15:59:50 -0000

Hi Roger,

reviving this discussion, since we have a Github ticket for 2.7.5:
https://github.com/networkupstools/nut/issues/293

2016-06-05 12:34 GMT+02:00 Roger Price <roger at rogerprice.org>:

> On Sat, 4 Jun 2016, Charles Lepple wrote:
>
> On Jun 3, 2016, at 6:48 AM, Roger Price <roger at rogerprice.org>
wrote:
>>
>>> ... the timer.  I don't see it in /var/lib/ups where the locate
tool
>>> finds upsd.pid, and I don't see it in /run or /var/run where I
see
>>> upsmon.pid.
>>>
>>> ... it seems that the timers are only stored in memory. See
>> checktimers(): https://github.com/networkupst
>> ools/nut/blob/master/clients/upssched.c#L129
>>
>
> Hello Charles, thanks for the link.  If timers are only stored in memory
> then the example given at http://networkupstools.org/doc
> s/user-manual.chunked/ar01s07.html chapter 7.2 is wrong.  It is not
> possible to turn off a timer with rm as shown in
>
>         #! /bin/sh
>         case $1 in
>                 ...
>                 ups-back-on-power)
>                         /bin/rm -f /some/path/ups-on-battery
>                         ;;
>                 ...
>         esac
>
> This would explain the problem I have with a current script.
>

I've made some additions to clarify things on the timer, and complete the
script:
https://github.com/networkupstools/nut/compare/upssched-doc?expand=1


> Is there some other way of forcing routine cancel_timer from a script or a
> configuration file?
>

this is the last point to address, but I'd need to better understand prior
to potentially taking action:
theoretically, each event that triggers a timer (like ONBATT) has a
counterpart to cancel it (like ONLINE).
Ex (from the doc):
    AT ONBATT * START-TIMER onbattwarn 30
    AT ONLINE * CANCEL-TIMER onbattwarn

So is there any use case we're missing here?

Thanks and cheers,
Arno
--
Eaton Data Center Automation Solutions - Opensource Leader -
http://42ity.org
NUT (Network UPS Tools) Project Leader - http://www.networkupstools.org
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20170321/c665d27f/attachment.html>