Spacing
This commit is contained in:
parent
8da5a1d2c9
commit
583c259951
|
@ -61,12 +61,12 @@ GetOptions(
|
||||||
'autostop' =>\$options{autostop},
|
'autostop' =>\$options{autostop},
|
||||||
) or pod2usage(-exitstatus => -1);
|
) or pod2usage(-exitstatus => -1);
|
||||||
|
|
||||||
if ( !$id ) {
|
if (!$id) {
|
||||||
print(STDERR "Please give a valid monitor id\n");
|
print(STDERR "Please give a valid monitor id\n");
|
||||||
pod2usage(-exitstatus => -1);
|
pod2usage(-exitstatus => -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
( $id ) = $id =~ /^(\w+)$/;
|
($id) = $id =~ /^(\w+)$/;
|
||||||
logInit($id?(id=>'zmcontrol_'.$id):());
|
logInit($id?(id=>'zmcontrol_'.$id):());
|
||||||
|
|
||||||
my $sock_file = $Config{ZM_PATH_SOCKS}.'/zmcontrol-'.$id.'.sock';
|
my $sock_file = $Config{ZM_PATH_SOCKS}.'/zmcontrol-'.$id.'.sock';
|
||||||
|
@ -76,7 +76,7 @@ socket(CLIENT, PF_UNIX, SOCK_STREAM, 0) or Fatal("Can't open socket: $!");
|
||||||
|
|
||||||
my $saddr = sockaddr_un($sock_file);
|
my $saddr = sockaddr_un($sock_file);
|
||||||
|
|
||||||
if ( $options{command} ) {
|
if ($options{command}) {
|
||||||
# Have a command, so we are the client, connect to the server and send it.
|
# Have a command, so we are the client, connect to the server and send it.
|
||||||
|
|
||||||
my $tries = 10;
|
my $tries = 10;
|
||||||
|
@ -101,18 +101,16 @@ if ( $options{command} ) {
|
||||||
Error("Unable to connect to zmcontrol server at $sock_file");
|
Error("Unable to connect to zmcontrol server at $sock_file");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
# The server isn't there
|
# The server isn't there
|
||||||
my $monitor = zmDbGetMonitorAndControl($id);
|
my $monitor = zmDbGetMonitorAndControl($id);
|
||||||
if ( !$monitor ) {
|
Fatal("Unable to load control data for monitor $id") if !$monitor;
|
||||||
Fatal("Unable to load control data for monitor $id");
|
|
||||||
}
|
|
||||||
my $protocol = $monitor->{Protocol};
|
my $protocol = $monitor->{Protocol};
|
||||||
if ( !$protocol ) {
|
if (!$protocol) {
|
||||||
Fatal('No protocol is set in monitor. Please edit the monitor, edit control type, select the control capability and fill in the Protocol field');
|
Fatal('No protocol is set in monitor. Please edit the monitor, edit control type, select the control capability and fill in the Protocol field');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( -x $protocol ) {
|
if (-x $protocol) {
|
||||||
# Protocol is actually a script!
|
# Protocol is actually a script!
|
||||||
# Holdover from previous versions
|
# Holdover from previous versions
|
||||||
my $command .= $protocol.' '.$arg_string;
|
my $command .= $protocol.' '.$arg_string;
|
||||||
|
@ -120,11 +118,11 @@ if ( $options{command} ) {
|
||||||
|
|
||||||
my $output = qx($command);
|
my $output = qx($command);
|
||||||
my $status = $? >> 8;
|
my $status = $? >> 8;
|
||||||
if ( $status || logDebugging() ) {
|
if ($status || logDebugging()) {
|
||||||
chomp($output);
|
chomp($output);
|
||||||
Debug("Output: $output");
|
Debug("Output: $output");
|
||||||
}
|
}
|
||||||
if ( $status ) {
|
if ($status) {
|
||||||
Error("Command '$command' exited with status: $status");
|
Error("Command '$command' exited with status: $status");
|
||||||
exit($status);
|
exit($status);
|
||||||
}
|
}
|
||||||
|
@ -134,7 +132,7 @@ if ( $options{command} ) {
|
||||||
Info("Starting control server $id/$protocol");
|
Info("Starting control server $id/$protocol");
|
||||||
close(CLIENT);
|
close(CLIENT);
|
||||||
|
|
||||||
if ( ! can_load( modules => { "ZoneMinder::Control::$protocol" => undef } ) ) {
|
if (!can_load(modules => {'ZoneMinder::Control::'.$protocol => undef})) {
|
||||||
Fatal("Can't load ZoneMinder::Control::$protocol\n$Module::Load::Conditional::ERROR");
|
Fatal("Can't load ZoneMinder::Control::$protocol\n$Module::Load::Conditional::ERROR");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +157,7 @@ if ( $options{command} ) {
|
||||||
$control->open();
|
$control->open();
|
||||||
|
|
||||||
# If we have a command when starting up, then do it.
|
# If we have a command when starting up, then do it.
|
||||||
if ( $options{command} ) {
|
if ($options{command}) {
|
||||||
my $command = $options{command};
|
my $command = $options{command};
|
||||||
$control->$command(\%options);
|
$control->$command(\%options);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue