Skip to content

Commit 6423afa

Browse files
Remove impossible code for sending a command after server startup
1 parent 6b30d73 commit 6423afa

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

scripts/zmcontrol.pl.in

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# ==========================================================================
2323

2424
use strict;
25+
use warnings;
2526

2627
@EXTRA_PERL_LIB@
2728
use ZoneMinder;
@@ -100,7 +101,7 @@ if ($options{command}) {
100101
Error("Unable to connect to zmcontrol server at $sock_file");
101102
}
102103
} else {
103-
# The server isn't there
104+
# We are the server
104105
require ZoneMinder::Monitor;
105106

106107
my $monitor = ZoneMinder::Monitor->find_one(Id=>$id);
@@ -124,21 +125,14 @@ if ($options{command}) {
124125
$SIG{TERM} = \&TermHandler;
125126
$SIG{INT} = \&TermHandler;
126127

127-
Info("Control server $id/$protocol starting at "
128-
.strftime('%y/%m/%d %H:%M:%S', localtime())
129-
);
128+
Info("Control server $id/$protocol starting at " .strftime('%y/%m/%d %H:%M:%S', localtime()));
130129

131130
$0 = $0.' --id '.$id;
132131

133132
my $control_key = $control->getKey();
134133
$control->loadMonitor();
135-
136-
$control->open();
137-
138-
# If we have a command when starting up, then do it.
139-
if ($options{command}) {
140-
my $command = $options{command};
141-
$control->$command(\%options);
134+
if (!$control->open()) {
135+
Warning("Failed to open control");
142136
}
143137

144138
socket(SERVER, PF_UNIX, SOCK_STREAM, 0) or Fatal("Can't open socket: $!");

0 commit comments

Comments
 (0)