The Network UPS Tools repository. UPS management protocol Informational RFC 9271 published by IETF at https://www.rfc-editor.org/info/rfc9271 Please star NUT on GitHub, this helps with sponsorships!
When upsd or upsmon are started in foreground mode -F, by default they run without a PID file. This precludes use of upsd -c reload and similar command-line activities.
As one idea, NUT protocol could be extended for upsd without a PID file to check if its currently configured port/IP are listened, and query there for a new GETPID command - for the running daemon to respond (PID number on POSIX systems, something else in WIN32), at least if it is not frozen. Then the CLI program instance can send signals to the daemon same as it does now, relying on OS protection with regard to security. Something similar could be done with upsmon instances, having them report PIDs to the data server they are connected to.
Context: this -F option is used in service units to reduce forking since 2.8.0 release. As a consequence, use of modern NUT OS integration precludes classic reload/stop activities via CLI, as users find in documentation or are used to do for years. A workaround is to run units with -FF option to both be foreground and leave a PID file, but this is somewhat not idiomatic for modern services anymore (and currently is only implemented for upsd, while upsmon calls writepid() regardless of fire/back-ground mode).
Alternative idea: NUT programs built with systemd integration can try to query systemctl show -p MainPID nut-monitor.service, and if OS permissions let them do it - use that PID. Possible caveat here is that different populations of NUT builds (e.g. packaged vs. custom-built experiments) might conflict and unexpectedly a system service might be asked to stop; however this should be resolved by using a different unprivileged account to build/test the experiments... In any case, if reliable PID files (e.g. found via built-in paths) are not available, many bets are off.
See also:
1721
1299
This is not a high priority issue, just something to think about.
When
upsd
orupsmon
are started in foreground mode-F
, by default they run without a PID file. This precludes use ofupsd -c reload
and similar command-line activities.As one idea, NUT protocol could be extended for
upsd
without a PID file to check if its currently configured port/IP are listened, and query there for a newGETPID
command - for the running daemon to respond (PID number on POSIX systems, something else in WIN32), at least if it is not frozen. Then the CLI program instance can send signals to the daemon same as it does now, relying on OS protection with regard to security. Something similar could be done withupsmon
instances, having them report PIDs to the data server they are connected to.Context: this
-F
option is used in service units to reduce forking since 2.8.0 release. As a consequence, use of modern NUT OS integration precludes classic reload/stop activities via CLI, as users find in documentation or are used to do for years. A workaround is to run units with-FF
option to both be foreground and leave a PID file, but this is somewhat not idiomatic for modern services anymore (and currently is only implemented forupsd
, whileupsmon
callswritepid()
regardless of fire/back-ground mode).Alternative idea: NUT programs built with systemd integration can try to query
systemctl show -p MainPID nut-monitor.service
, and if OS permissions let them do it - use that PID. Possible caveat here is that different populations of NUT builds (e.g. packaged vs. custom-built experiments) might conflict and unexpectedly a system service might be asked to stop; however this should be resolved by using a different unprivileged account to build/test the experiments... In any case, if reliable PID files (e.g. found via built-in paths) are not available, many bets are off.See also:
1721
1299
This is not a high priority issue, just something to think about.