[Nut-upsdev] Patch: upssched puts UPS name in the command line

Kiss Gabor (Bitman) kissg at ssg.ki.iif.hu
Tue Jun 22 14:12:30 UTC 2010


> > So I think yet introducing % tokens in the command line is not so bad idea.
> > I mean %u would be substituted by UPS name, %n stands for notify type
> > (including timer expiry), etc.
> 
> If knowing the UPSNAME is important for your timers, you should not be using
> '*' as upsname. Likewise, if the NOTIFYTYPE is important to kwow when the
> timer elapses, you should make this clear in the name of the timer.

'*' would be really funny. But imagine a regular expression as ups name:

AT ONBATT /fortress_[0-9]/ START-TIMER  "SENDPAGER %u" 120
AT ONLINE /fortress_[0-9]/ CANCEL-TIMER "SENDPAGER %u"

(Regular expression "names" will be my next suggestion/invention. :)

> This is obvious if you consider what the timers are supposed to do. If two or
> more UPSes (or events) start the same timer there will be ambiguity what needs
> to be done when a UPS (or event) needs to cancel a timer. Should it cancel all
> timers with the same name? Or only the ones with a matching UPSNAME? Which of
> these two makes sense, depends on the action performed by the timer.

The above example is unambigous. Timers are _not_ the same.
Each of them has different name. E.g. "SENDPAGER fortress_7"

Regards

Gabor
-- 
E-mail = m-mail * c-mail ^ 2



More information about the Nut-upsdev mailing list