-
Notifications
You must be signed in to change notification settings - Fork 3.8k
nut: fix driver, server, and monitor reload/stop #28382
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
base: master
Are you sure you want to change the base?
nut: fix driver, server, and monitor reload/stop #28382
Conversation
shellcheck is a useful linter if a bit pedantic and overzealous so add overrides to silence false positives Also, fix issues found by the linting. * misspelling meant initscript could skip updating configuration in certain circumstances * minor: assignment of the result of execution as the time of creating local. This has been separated. likewise cspell is useful for getting spellings right and avoiding typos, so override false positives for it as well Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
This is a noop, but since we are here. Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Updated configuration was not being applied after config change. This was due to the means used to do the daemon reloads. Closes openwrt#28298 "Drivers not restarted on config change" Enable creating PID files for the server, driver, and monitor daemon processes. This allows to use NUT's built-in facilities for signalling the daemon's. For server, when reloading: 1. Check if upsd is running 1. If not, start it. 2. If it is send reload signal to upsd 2. For each driver: 1. Check if the driver is running 1. If it is, send reload-or-exit signal to driver 2. If driver is not running, start it 3. Attempt to start server (upsd and drivers) if service was stopped. For server, when stopping: 1. Check if upsd is running 1. If it is send stop signal to upsd 2. Ensure it really is stopped 2. For each driver: 1. Check if the driver is running 1. If it is, send stop signal to driver 2. If driver is still running, stop it. 3. If the server process is active (even with not upsd or drivers), stop it. For monitor, send the reload signal on config change, with fallback to stopping and starting the daemon. Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
a298ac3 to
865f444
Compare
| start_service "$@" | ||
| local should_stop_upsd | ||
| local STATEPATH=/var/run/nut | ||
| local haveserver=0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does haveserver signify? That the file exists or it's running?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. It is that the upsd (server) configuration is present. Likewise havedriver should be haveupsconfig to differentiate between a driver and and a driver instance (which is for a specific ups). haveupsdconfig?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better. Make booleans as descriptive and concise as possible, here, so it's easy to follow what we're flagging. This nut thing is not simple, which possibly explains why we're in this situation to begin with :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to avoid words like "should" since we all know what happens in reality. shall or will or needs.
📦 Package Details
Maintainer: @hnyman @s-hamann @drujd @tofurky @neheb @BKPepe @systemcrash @rpavlik
No maintainer, so spamming last 2.x years worth of folks who may be interested.
Description:
Updated configuration was not being applied after config change. This
was due to the means used to do the daemon reloads.
Closes #28298 "Drivers not restarted on config change"
Enable creating PID files for the server, driver, and monitor daemon
processes. This allows to use NUT's built-in facilities for signalling
the daemon's.
For server, when reloading:
For server, when stopping:
stop it.
For monitor, send the reload signal on config change, with fallback to
stopping and starting the daemon.
In the process added linting (ignoring false positives) and fixed whitespace inconsistency.
🧪 Run Testing Details
Only tested with dummy-ups so far. I have a spare UPS on order which should arrive this coming week.
Needs more testing and review.
✅ Formalities