<div dir="ltr">Hi Roger,<br><div><div class="gmail_extra"><br><div class="gmail_quote">2017-03-28 15:07 GMT+02:00 Roger Price <span dir="ltr"><<a target="_blank" href="mailto:roger@rogerprice.org">roger@rogerprice.org</a>></span>:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">Hi Arnaud,<span class="gmail-"><br>
<br>
On Wed, 22 Mar 2017, Arnaud Quette wrote:<br>
<br>
</span><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span class="gmail-">
      The technique is very general and is to send SIGUSR1/SIGUSR2 to the upsd daemon.  SIGUSR1 and SIGUSR2 are events just like ONBATT and ONLINE.<br>
      The patch runs successfully on my opensuse 13.2 box, and solves my problem. In upssched.conf I now have declarations such as<br>
<br>
         AT SIGUSR1 * CANCEL-TIMER shutdown-timer<br>
<br>
      Will my patches be included in NUT?<br>
<br></span><span class="gmail-">
I've quickly checked your 2 patches.  The solution seems to me not broad enough for injecting upstream. This works nice for a single device / UPS setup, but would not make it when there are more devices, as I get it.<br>
</span></blockquote>
<br>
True, I use SIGUSR1 and SIGUSR2 which do not allow a payload such as a UPS unit name.  That would require SIGQUEUE, which accepts integers and pointers to other values (such as UPS unit names), but a Bash script can only send integers with SIGQUEUE.  Sending pointers to UPS unit names would require a new C program.  This would be a good programming exercise, but no-one has asked for such a facility in NUT.<br>
<br>
I suspect that only a small percentage of NUT users use upssched timers.<span class="gmail-"><br>
<br>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
At first sight, I would more see something injecting into the PIPEFN fifo, i.e. acting the same way upsmon would when calling upssched with the upsname and the triggering event.<br>
I think that this can be solved more easily with tools like socat or nc, sending the command directly to the pipe. For example, to cancel the timer "shutdown-timer" from the upssched-cmd script, you would:<br>
<br>
       echo "CANCEL shutdown-timer" | socat - UNIX-CLIENT:/var/run/nut/upssc<wbr>hed.pipe<br>
</blockquote>
<br></span>
What a hack! :-) Sure, it is possible to do clever things with such tools, but I wanted something that used the .conf files to express the configuration.<br>
<br>
I also considered using a dummy UPS with a .dev script written and erased as needed by a Bash script.<span class="gmail-"><br>
<br>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
Please tell me back if such solution would make it for you.<br>
</blockquote>
<br></span>
For the moment I will stick with my SIGUSR patches.<span class="gmail-"><br>
<br>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
I also realize that the distributed sample configuration and scripts do not fully match the doc. I'll make another round of update for this, still on the same branch.<br>
</blockquote>
<br>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
I would warmly welcome your help to complete the documentation, both with part of your patches that make sense,<br>
</blockquote>
<br></span>
I think the user documentation would benefit from an explanation that there are two possible approaches to NUT configuration: Simple/optimistic, without timers, and pessimistic with timers.  And then a complete, fully worked example of the NUT setup for the simplest usage based on OB and LB (no timers).  The example on my website covers the pessimistic (with timers) approach only.<span class="gmail-"><br>
<br>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
along with the above solution if it's good too.<br>
</blockquote>
<br></span>
I would not recommend putting a technique based on socat/nc/netcat in the NUT user documentation, but perhaps under a heading such as "Debugging" it would be worth having it in the Developer Guide.<br></blockquote></div><br></div><div class="gmail_extra">would you be kind enough to complete the ticket on Github, so that we track and address this after 2.7.5?<br><a href="https://github.com/networkupstools/nut/issues/293">https://github.com/networkupstools/nut/issues/293</a><br><br clear="all"></div><div class="gmail_extra">I'm intending to finally release it soon, and to have more doc improvement for the next release.<br></div><div class="gmail_extra">And your help is definitely welcome!<br><br></div><div class="gmail_extra">thanks and cheers,<br></div><div class="gmail_extra">Arno<br></div><div class="gmail_extra">-- <br><div class="gmail_signature">Eaton Data Center Automation Solutions - Opensource Leader - <a target="_blank" href="http://42ity.org">http://42ity.org</a><br>NUT (Network UPS Tools) Project Leader - <a target="_blank" href="http://www.networkupstools.org">http://www.networkupstools.org</a><br>Debian Developer - <a target="_blank" href="http://www.debian.org">http://www.debian.org</a><br>Free Software Developer - <a target="_blank" href="http://arnaud.quette.fr">http://arnaud.quette.fr</a><br></div>
</div></div></div>