Just launch nut-server systemd service if we are not on netclient mode#3233
Just launch nut-server systemd service if we are not on netclient mode#3233jimklimov merged 5 commits intonetworkupstools:masterfrom
Conversation
Tested with ExecCondition=/bin/sh -c '[ "$MODE" != "netclient" ]' an
|
This looks like a neat idea in fact, may help fix the long-standing issue #837 and loosely related to the likes of #156 (and others referred from these two). Did you check if this actually works, e.g. things are not getting broken by various values of Other than that, your original issue can be addressed by |
|
Thanks I didn't find those issues. This it's what I have tested with
I could complicate the test with something like Happy to do more testing if anyone has something in mind. |
Not sure if there is a better way to call `sh` without assuming a static dir. Something like `command -v sh`
|
I think the linked older issues suggested that (packaged) services are supposed to be pre-set to try starting automatically, and decide at run-time if they would run. Regarding your practical tests, failures due to lack of UPS config (and no ALLOW_NO_DEVICES in effect) may be more holistically solved by adding some Per https://www.freedesktop.org/software/systemd/man/systemd.unit.html the |
|
Hi, I'm glad this could help previous discussions (I have now read the other issues and I see this was a discussed topic). I like the I tried to look at https://github.com/networkupstools/nut/blob/master/configure.ac but it's too much for my dev skills (I'm a sysadmin). According to https://pkgs.org/download/systemd and https://repology.org/project/systemd/versions there are only 2 main distros with systemd < 243. Enterprise Linux 8 (RHEL, Rocky Linux, AlmaLinux)
And AmazonLinux 2 (EOL on 2026-06-30)
So, it is going to be any old distro with systemd < 243 and a updated version of nut > 2.8.4 ? I use Arch, debian and Ubuntu, so I'm probably not aware of the whole ecosystem of PD: Just integrated today |
|
FWIW, |
Yeah, for that use case makes sense. |
…BLE_EXEC_CONDITION@ and put ExecCondition for MODE values into more units; depend from NDE path units also on nut.conf changes; bump systemd integration copyrights [networkupstools#3233] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…: rename nut-udev-settle.service into a .in template, handle ExecCondition here too [networkupstools#3233] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
|
PR updated, tested locally with The unit is "dead" because |
|
Wow, great work. Full support of |
|
Hm, actually Meant to experiment with |
… also consider "none" [networkupstools#3233] Also fix nut-monitor.service (upsmon) to still start for a "netserver": it is a full setup like "standalone", just with not only `localhost` clients expected. Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
networkupstools#3008 Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Tested with
ExecCondition=/bin/sh -c '[ "$MODE" != "netclient" ]'This is more than a RFC than an intent to have the PR merged.
nut.targettries to startnut-driver.targetnut-server.servicenut-monitor.service.On distros like Arch where nut is packaged as only one package, configured as netclient system,
nut-server.servicefails withFatal error: at least one UPS must be defined in ups.conf.Tried to just enable
nut-monitor.servicebut seems not to work withoutnut.targetenabled. 1If
upsdcould detect theMODE=netclientand exits without failing could be another solution.So my questions is: if making
nut-server.serviceonly start if we are not onMODE=netclientis something that upstream could consider? , or if I should ask this on Arch itself?Thanks for this great software!