daemonize zmcontrol (#2563)
This commit is contained in:
parent
110e5075f4
commit
2bb15c4f90
|
@ -63,8 +63,8 @@ GetOptions(
|
|||
'autostop' =>\$options{autostop},
|
||||
) or pod2usage(-exitstatus => -1);
|
||||
|
||||
if ( !$id || !$options{command} ) {
|
||||
print( STDERR "Please give a valid monitor id and command\n" );
|
||||
if ( !$id ) {
|
||||
print( STDERR "Please give a valid monitor id\n" );
|
||||
pod2usage(-exitstatus => -1);
|
||||
}
|
||||
|
||||
|
@ -201,8 +201,10 @@ if ( !$server_up ) {
|
|||
#print( "Writing commands\n" );
|
||||
CLIENT->autoflush();
|
||||
|
||||
my $message = jsonEncode(\%options);
|
||||
print(CLIENT $message);
|
||||
if ( $options{command} ) {
|
||||
my $message = jsonEncode(\%options);
|
||||
print(CLIENT $message);
|
||||
}
|
||||
shutdown(CLIENT, 1);
|
||||
|
||||
exit(0);
|
||||
|
@ -216,7 +218,7 @@ zmcontrol.pl - ZoneMinder control script
|
|||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
zmcontrol.pl --id {monitor_id} --command={command} [various options]
|
||||
zmcontrol.pl --id {monitor_id} [--command={command}] [various options]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ my @daemons = (
|
|||
'zmupdate.pl',
|
||||
'zmstats.pl',
|
||||
'zmtrack.pl',
|
||||
'zmcontrol.pl',
|
||||
'zmtelemetry.pl'
|
||||
);
|
||||
|
||||
|
|
|
@ -220,13 +220,16 @@ if ( $command =~ /^(?:start|restart)$/ ) {
|
|||
runCommand("zmdc.pl start zma -m $monitor->{Id}");
|
||||
}
|
||||
if ( $Config{ZM_OPT_CONTROL} ) {
|
||||
if ( $monitor->{Controllable} && $monitor->{TrackMotion} ) {
|
||||
if ( $monitor->{Controllable} ) {
|
||||
runCommand("zmdc.pl start zmcontrol.pl --id $monitor->{Id}");
|
||||
if ( $monitor->{TrackMotion} ) {
|
||||
if ( $monitor->{Function} eq 'Modect' || $monitor->{Function} eq 'Mocord' ) {
|
||||
runCommand("zmdc.pl start zmtrack.pl -m $monitor->{Id}");
|
||||
} else {
|
||||
Warning('Monitor is set to track motion, but does not have motion detection enabled.');
|
||||
} # end if Has motion enabled
|
||||
} # end if track motion
|
||||
} # end if controllable
|
||||
} # end if ZM_OPT_CONTROL
|
||||
} # end if function is not none or Website
|
||||
} # end foreach monitor
|
||||
|
|
Loading…
Reference in New Issue