-
-
Notifications
You must be signed in to change notification settings - Fork 423
Description
https://alioth-lists.debian.net/pipermail/nut-upsuser/2022-December/013026.html
... Just for grins, I edited /etc/ups/upsd.conf to uncomment the STATEPATH
line. I set it to /run/nut. When I ran upsd -DD again, it was still
looking at /var/run. However! It successfully connected to the
cyberpower device. Upsc returns good information.
# upsd -DD
> Network UPS Tools upsd 2.8.0
> 0.000000 fopen /var/run/upsd.pid: No such file or directory
> 0.000037 Could not find PID file '/var/run/upsd.pid' to see if
> previous upsd instance is already running!
>
> 0.000271 [D1] debug level is '2'
> 0.000357 listening on ::1 port 3493
> 0.000395 listening on 127.0.0.1 port 3493
> 0.001550 Connected to UPS [cyberpower]: usbhid-ups-cyberpower
Curious finding up there. I think this is due to load_upsdconf(0); being at https://github.com/networkupstools/nut/blob/master/server/upsd.c#L1776 -- so being after the initial signal-probing for competitors (or sending a command to a running daemon), so using built-in PID/STATE paths, and notably that probing happens before the optional chrooting (and PID file is later recorded relative to the chroot).
For that initial probing, it would honor the NUT_ALTPIDPATH envvar (although still disregarding "relative to chroot" part if used), but not yet the know config file contents.
So it is messed up somewhat.
FWIW, last week I tried to track down current usage of various PATHs in the sources, see #1712 (comment) if interested :)
CC @aquette @clepple : is this a low-hanging fruit (to smartly reshuffle a few lines), or do I miss something in the bigger picture and historic considerations?
See also: