[Nut-upsuser] Is a timer a file?

Charles Lepple
Sun, 05 Jun 2016 14:57:27 -0000

> On Jun 5, 2016, at 6:34 AM, Roger Price <roger at rogerprice.org>
wrote:
>
> 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/networkupstools/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/docs/user-manual.chunked/ar01s07.html chapter 7.2 is
wrong.  It is not possible to turn off a timer with rm as shown in

I think that "rm" corresponds to the file mentioned in the phrase
"To enable this we could, at the same time, create a file which is read and
displayed to any user trying to login whilst the UPS is on battery power."

I would agree that the code to create that file is missing from the example,
though.

Issue: https://github.com/networkupstools/nut/issues/293

> This would explain the problem I have with a current script.
>
> Is there some other way of forcing routine cancel_timer from a script or a
configuration file?

Again, I don't use upssched myself, but my understanding is that timers are
internal to upssched, and the only way to cancel them is through an event listed
in the configuration file.

I think the intent of the timers was to allow simple filtering of transient
events. With a lot of conditionals, I would want a better way to estimate test
coverage (at the system level) for all of the possible events and decisions.

--
Charles Lepple
clepple at gmail