It is okay to call daemonControl with function==None for command == stop. All others give a warning. Fixes monitors on other servers not stopping when set to None.
This commit is contained in:
parent
07dbb75c56
commit
fd9bef228d
|
@ -143,28 +143,28 @@ class Monitor extends AppModel {
|
||||||
);
|
);
|
||||||
|
|
||||||
public function daemonControl($monitor, $command, $daemon=null) {
|
public function daemonControl($monitor, $command, $daemon=null) {
|
||||||
if ( $monitor['Function'] == 'None' ) {
|
if ($monitor['Function'] == 'None' and $command != 'stop') {
|
||||||
ZM\Debug('Calling daemonControl when Function == None');
|
ZM\Warning("Calling daemonControl with command $command when Function == None");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( defined('ZM_SERVER_ID') and ($monitor['ServerId']!=ZM_SERVER_ID) ) {
|
if (defined('ZM_SERVER_ID') and ($monitor['ServerId']!=ZM_SERVER_ID)) {
|
||||||
ZM\Error('Calling daemonControl for Monitor assigned to different server. Our server id '.ZM_SERVER_ID.' != '.$monitor['ServerId']);
|
ZM\Error('Calling daemonControl for Monitor assigned to different server. Our server id '.ZM_SERVER_ID.' != '.$monitor['ServerId']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$daemons = array();
|
$daemons = array();
|
||||||
if ( ! $daemon ) {
|
if (!$daemon) {
|
||||||
array_push($daemons, 'zmc');
|
array_push($daemons, 'zmc');
|
||||||
} else {
|
} else {
|
||||||
array_push($daemons, $daemon);
|
array_push($daemons, $daemon);
|
||||||
}
|
}
|
||||||
|
|
||||||
$status_text = '';
|
$status_text = '';
|
||||||
foreach ( $daemons as $daemon ) {
|
foreach ($daemons as $daemon) {
|
||||||
$args = '';
|
$args = '';
|
||||||
if ( $daemon == 'zmc' and $monitor['Type'] == 'Local' ) {
|
if ($daemon == 'zmc' and $monitor['Type'] == 'Local') {
|
||||||
$args = '-d ' . $monitor['Device'];
|
$args = '-d ' . $monitor['Device'];
|
||||||
} else if ( $daemon == 'zmcontrol.pl' ) {
|
} else if ($daemon == 'zmcontrol.pl') {
|
||||||
$args = '--id '.$monitor['Id'];
|
$args = '--id '.$monitor['Id'];
|
||||||
} else {
|
} else {
|
||||||
$args = '-m ' . $monitor['Id'];
|
$args = '-m ' . $monitor['Id'];
|
||||||
|
|
Loading…
Reference in New Issue