Fix controlling daemon when the monitor is Local
This commit is contained in:
parent
3109536dda
commit
cd64619743
|
@ -332,24 +332,17 @@ class MonitorsController extends AppController {
|
|||
}
|
||||
|
||||
public function daemonControl($id, $command, $monitor=null, $daemon=null) {
|
||||
$args = '';
|
||||
$daemons = array();
|
||||
|
||||
if ( !$monitor ) {
|
||||
// Need to see if it is local or remote
|
||||
$monitor = $this->Monitor->find('first', array(
|
||||
'fields' => array('Type', 'Function'),
|
||||
'fields' => array('Type', 'Function', 'Device'),
|
||||
'conditions' => array('Id' => $id)
|
||||
));
|
||||
$monitor = $monitor['Monitor'];
|
||||
}
|
||||
|
||||
if ($monitor['Type'] == 'Local') {
|
||||
$args = '-d ' . $monitor['Device'];
|
||||
} else {
|
||||
$args = '-m ' . $id;
|
||||
}
|
||||
|
||||
if ( $monitor['Function'] == 'Monitor' ) {
|
||||
array_push($daemons, 'zmc');
|
||||
} else {
|
||||
|
@ -359,6 +352,13 @@ class MonitorsController extends AppController {
|
|||
$zm_path_bin = Configure::read('ZM_PATH_BIN');
|
||||
|
||||
foreach ($daemons as $daemon) {
|
||||
$args = '';
|
||||
if ( $daemon == 'zmc' and $monitor['Type'] == 'Local') {
|
||||
$args = '-d ' . $monitor['Device'];
|
||||
} else {
|
||||
$args = '-m ' . $id;
|
||||
}
|
||||
|
||||
$shellcmd = escapeshellcmd("$zm_path_bin/zmdc.pl $command $daemon $args");
|
||||
$status = exec( $shellcmd );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue