[Nut-upsuser] Foreground process possible?

Charles Lepple clepple at gmail.com
Fri Feb 17 03:10:31 UTC 2012


On Feb 16, 2012, at 2:39 PM, McCann, Brian wrote:

> So I got my UPS working.  I'm trying to get NUT to run under daemontools .  upsd and upsmon all seem to stay in the foreground when I add -D to them but upsdrvctl doesn't.  Does anyone know if there's a hidden switch or something to make it stay in the foreground?  The reason I want to use daemontools is so that if the process crashes, daemontools will just start it right back up again.  I run just about everything (Apache HTTPD is the only thing I have so far that won't stay in the foreground) under daemontools.  Much easier to check the status of all my services too.


The upsdrvctl binary is really just a convenience tool for rc.d scripts. As you may have seen when you pass -D (maybe several -Ds?), it prints the arguments that it will use to launch the driver(s). There is not much else to it - just a timer to make sure the driver isn't taking too long to launch. Drivers normally only go into the background after establishing a connection to the UPS hardware, but under daemontools, you would defeat that with -D (as you did with upsd and upsmon).

In order for daemontools to re-launch only the driver which crashes, it needs to monitor each driver separately. In that case, I would recommend bypassing upsdrvctl, and creating a separate daemontools service per driver. For my test system, the driver arguments would be "/lib/nut/tripplite_usb -a tripplite -D", but as I mentioned, upsdrvctl can print that.

-- 
Charles Lepple
clepple at gmail






More information about the Nut-upsuser mailing list