Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest in docs and daemon messages how command-signals vs. PID files vs. systemd units interact #1724

Merged
merged 12 commits into from Dec 3, 2022

Conversation

jimklimov
Copy link
Member

Follow-up from #1721 discussions, mostly to clarify docs and messages to be more actionable with regard to changes in NUT 2.8.0 and systemd unit wrapping (e.g. that by default it starts upsd -F and so does not save PID files).

Also clarifies some example texts to be more consistent between files (e.g. NUT user for upsmon).

@jimklimov jimklimov added enhancement documentation service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug Linux Some issues are specific to Linux as a platform labels Dec 1, 2022
@jimklimov jimklimov added this to the 2.8.1 milestone Dec 1, 2022
@jimklimov
Copy link
Member Author

jimklimov commented Dec 2, 2022

For builds with systemd:

$ ./server/upsd -c reload
Network UPS Tools upsd 2.8.0-175-g3d5537378
fopen /var/state/ups/upsd.pid: No such file or directory
Try 'systemctl reload nut-server.service' or add '-P $PID' argument

$ ./server/upsd -c reload -P 123123
Network UPS Tools upsd 2.8.0-175-g3d5537378
kill: No such process
Try 'systemctl reload nut-server.service'

For builds on other systems:

$ ./server/upsd -c reload
Network UPS Tools upsd 2.8.0-182-gdbe5e39e6
fopen /var/state/ups/upsd.pid: No such file or directory
Failed to signal the currently running daemon
Try to add '-P $PID' argument

$ ./server/upsd -c reload -P 123123
Network UPS Tools upsd 2.8.0-182-gdbe5e39e6
kill: No such process
Failed to signal the currently running daemon

While not a 100% exact science (we might delve into detailing different return codes from the sendsignal*() but do not do so here), this is hopefully actionable enough for troubleshooting.

@AppVeyorBot

This comment was marked as resolved.

@jimklimov
Copy link
Member Author

jimklimov commented Dec 2, 2022

Getting closer to "some % exact science" -- by refactoring the code for detection and reporting of probe/signal outcomes into one block:

$ ./server/upsd -c reload
Network UPS Tools upsd 2.8.0-182-gdbe5e39e6
fopen /var/state/ups/upsd.pid: No such file or directory
Could not find PID file '/var/state/ups/upsd.pid' to see if previous upsd instance is already running!
Failed to signal the currently running daemon (if any)
Try to add '-P $PID' argument

$ ./server/upsd -c reload -P1
Network UPS Tools upsd 2.8.0-182-gdbe5e39e6
kill: Operation not permitted
Failed to signal the currently running daemon (if any)

$ ./server/upsd -c reload -P123123
Network UPS Tools upsd 2.8.0-182-gdbe5e39e6
kill: No such process
Failed to signal the currently running daemon (if any)

As can be seen in make check-NIT the normal start-up is "reasonably noisy":

[INFO] Starting UPSD for sandbox
Network UPS Tools upsd 2.8.0-188-gc78e889c4
fopen /home/jim/nut/tests/NIT/tmp/run/upsd.pid: No such file or directory
Could not find PID file '/home/jim/nut/tests/NIT/tmp/run/upsd.pid' to see if previous upsd instance is already running!
listening on ::1 port 35064
listening on 127.0.0.1 port 35064
  • It did not find a PID file from previous instance; only the future can tell what it means:
    • this may mean nobody to conflict with
    • this may mean poor tracking of someone to conflict with
  • in this example there was no conflict (port available)

@AppVeyorBot
Copy link

@jimklimov
Copy link
Member Author

See some more testing of commands vs. starts with and without a competing daemon in #1728 research trail.

@jimklimov jimklimov merged commit 54c9a1e into networkupstools:master Dec 3, 2022
@jimklimov jimklimov deleted the upsd-reload-systemd branch December 3, 2022 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation enhancement Linux Some issues are specific to Linux as a platform service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants