Repository navigation
fix: restart zmcontrol.pl when a monitor is edited through the API - #5205
Merged
connortechnology merged 1 commit intoOct 11, 2026
Merged
Conversation
MonitorsController::edit() restarted zmc through the CakePHP model but left the monitor's control server running. zmcontrol.pl reads ControlAddress, ControlDevice and the Control when it starts, so after an API edit PTZ kept using the old values: a camera password changed through the API kept failing PTZ with 401 until zmcontrol.pl was restarted by hand. Restart the daemons the way the console's save does (includes/actions/monitor.php), through ZM\Monitor: stop zmc and, for a controllable monitor, zmcontrol.pl; start them again from the saved row unless the monitor does not capture, is a WebSite or is deleted. ZM\Monitor also sends the commands to the monitor's own server in a multi-server setup, where the model's daemonControl() logged an error and did nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
zmcontrol.pl, so PTZ keeps the old camera settings.edit()stops and starts the monitor's daemons throughZM\Monitor, the same way the console save does, sozmcontrol.plis restarted too and the commands reach the monitor's own server. 1 file, +20/-7.{"message":"Saved"}). Checked on one and two nodes, with the API contract tests and the client suites.Details: change, behaviour changes, checks
Before
Upstream master
6c0f976c2:ControlAddresschanged through the API to a wrong password, then PTZ:zmcontrol.pl pid 593 (then 593); camera saw [... 200, ... 200]: the old process, still logging in with the old password.Change
web/api/app/Controller/MonitorsController.phpedit(): before saving, aZM\Monitorfor the old row stops zmc and, if it was controllable,zmcontrol.pl; after saving, aZM\Monitorfrom the saved row starts them unless Capturing is None, or the monitor is a WebSite or Deleted, the same rules asincludes/actions/monitor.php.Behaviour changes
zmcontrol.plZM\Monitoralready routes by serverAfter
Branch at
88cc49e34(base6c0f976c2).zmcontrol.pl pid 508 (then 508); camera saw [401 x6]: PASS (a new process, using the new settings)Not run: release-1.38 (same code; the patch applies with
git am -3), resilience.Possible follow-ups
Offered for discussion, not part of this change:
monitors/daemonControlfor another server's monitor answers 200status: okand does nothing (it logs an error;Model/Monitor.php:195-198,MonitorsController.php:493-503). Options: answer 400 naming the monitor's server, or forward the request to it. Benefit: callers learn the command didn't run. Risk: an API answer changes; ZoneMinder's own callers already target the right server, and of the known clients only zmNinjaNg calls daemon control, throughhost/daemonControl. A lab-tested 400 version exists; it would be its own PR with a release note.refs #5204
🤖 Generated with Claude Code