[Nut-upsdev] Autodetecting running drivers by the 'upsd' server

Arjen de Korte nut+devel at de-korte.org
Wed Jun 6 11:48:00 UTC 2007


>> 1) Drivers must have created their socket before the server is
>> started. This is not different from what we have now, but the server
>> wouldn't be able to detect that a driver which should be running
>> (according to 'ups.conf') is not available. Personally, I don't think
>> this is not much of a problem as long as 'upsdrvctl' complains about
>> this (which it usually does).
> The server could periodically look for new sockets (and/or on SIGHUP).

I'm not in favor of periodically looking for new sockets. If you don't
start additional drivers, it is pointless to check for new sockets
regularly. A better option would be for the drivers to send a SIGHUP to
the server on startup (if a 'upsd.pid' file is found), which we already
honor. The prerequisite that drivers and server are running under the same
UID is satisfied most of the time (if not always) anyway, since they will
have to communicate to one another. The bonus here is, that we might send
a SIGHUP to the server on intentional termination of the driver too, so
that it wouldn't be checking for stale sockets forever. This opens the way
for true hot(un)plugging of drivers.

>> 2) The STATEPATH should be dedicated for the driver, since the server
>> can't know in advance if a socket is for a NUT driver or some other
>> application that happens to be using the same directory for its
>> sockets. I don't think this is a big problem though.
> The nut directory in /var should be for the exclusive use of NUT anyway,
> for security (that way you can chown the directory to the nut user)

Most likely, yes.

Best regards, Arjen




More information about the Nut-upsdev mailing list