Add code to optionally run zmstats.pl and zmaudit.pl
parent
004fdbad9b
commit
abec2ce4cd
|
@ -191,16 +191,23 @@ if ( $command =~ /^(?:start|restart)$/ ) {
|
|||
zmMemTidy();
|
||||
runCommand('zmdc.pl startup');
|
||||
|
||||
my $Server = undef;
|
||||
my $sql;
|
||||
my @values;
|
||||
if ( $Config{ZM_SERVER_ID} ) {
|
||||
require ZoneMinder::Server;
|
||||
Info("Multi-server configuration detected. Starting up services for server $Config{ZM_SERVER_ID}\n");
|
||||
$Server = new ZoneMinder::Server( $Config{ZM_SERVER_ID} );
|
||||
$sql = 'SELECT * FROM Monitors WHERE ServerId=?';
|
||||
@values = ( $Config{ZM_SERVER_ID} );
|
||||
} else {
|
||||
Info('Single server configuration detected. Starting up services.');
|
||||
$sql = 'SELECT * FROM Monitors';
|
||||
}
|
||||
|
||||
my $sql = $Config{ZM_SERVER_ID} ? 'SELECT * FROM Monitors WHERE ServerId=?' : 'SELECT * FROM Monitors';
|
||||
my $sth = $dbh->prepare_cached( $sql )
|
||||
or Fatal( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute( $Config{ZM_SERVER_ID} ? $Config{ZM_SERVER_ID} : () )
|
||||
my $res = $sth->execute( @values )
|
||||
or Fatal( "Can't execute: ".$sth->errstr() );
|
||||
while( my $monitor = $sth->fetchrow_hashref() ) {
|
||||
if ( $monitor->{Function} ne 'None' ) {
|
||||
|
@ -226,10 +233,18 @@ if ( $command =~ /^(?:start|restart)$/ ) {
|
|||
# This is now started unconditionally
|
||||
runCommand('zmdc.pl start zmfilter.pl');
|
||||
if ( $Config{ZM_RUN_AUDIT} ) {
|
||||
runCommand('zmdc.pl start zmaudit.pl -c');
|
||||
if ( $Server and exists $$Server{'zmaudit.pl'} and ! $$Server{'zmaudit.pl'} ) {
|
||||
Debug("Not running zmaudit.pl because it is turned off for this server.");
|
||||
} else {
|
||||
runCommand('zmdc.pl start zmaudit.pl -c');
|
||||
}
|
||||
}
|
||||
if ( $Config{ZM_OPT_TRIGGERS} ) {
|
||||
runCommand('zmdc.pl start zmtrigger.pl');
|
||||
if ( $Server and exists $$Server{'zmtrigger.pl'} and ! $$Server{'zmtrigger.pl'} ) {
|
||||
Debug("Not running zmtrigger.pl because it is turned off for this server.");
|
||||
} else {
|
||||
runCommand('zmdc.pl start zmtrigger.pl');
|
||||
}
|
||||
}
|
||||
if ( $Config{ZM_OPT_X10} ) {
|
||||
runCommand('zmdc.pl start zmx10.pl -c start');
|
||||
|
@ -241,6 +256,11 @@ if ( $command =~ /^(?:start|restart)$/ ) {
|
|||
if ( $Config{ZM_TELEMETRY_DATA} ) {
|
||||
runCommand('zmdc.pl start zmtelemetry.pl');
|
||||
}
|
||||
if ( $Server and exists $$Server{'zmstats.pl'} and ! $$Server{'zmstats.pl'} ) {
|
||||
Debug("Not running zmstats.pl because it is turned off for this server.");
|
||||
} else {
|
||||
runCommand('zmdc.pl start zmstats.pl');
|
||||
}
|
||||
} else {
|
||||
$retval = 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue