fix log levels
This commit is contained in:
parent
b1f2b677c3
commit
4933b37b69
|
@ -183,39 +183,39 @@ use Sys::CpuLoad;
|
||||||
|
|
||||||
socket( CLIENT, PF_UNIX, SOCK_STREAM, 0 ) or Fatal( "Can't open socket: $!" );
|
socket( CLIENT, PF_UNIX, SOCK_STREAM, 0 ) or Fatal( "Can't open socket: $!" );
|
||||||
my $attempts = 0;
|
my $attempts = 0;
|
||||||
while( !connect( CLIENT, $saddr ) ) {
|
while( !connect(CLIENT, $saddr) ) {
|
||||||
$attempts++;
|
$attempts++;
|
||||||
Debug("Waiting for zmdc.pl server process at ".SOCK_FILE.", attempt $attempts" );
|
Debug("Waiting for zmdc.pl server process at ".SOCK_FILE.", attempt $attempts");
|
||||||
Fatal( "Can't connect: $!" ) if ($attempts > MAX_CONNECT_DELAY);
|
Fatal("Can't connect: $!") if $attempts > MAX_CONNECT_DELAY;
|
||||||
usleep(200000);
|
usleep(200000);
|
||||||
} # end while
|
} # end while
|
||||||
} elsif ( defined($cpid) ) {
|
} elsif ( defined($cpid) ) {
|
||||||
ZMServer::run();
|
ZMServer::run();
|
||||||
} else {
|
} else {
|
||||||
Fatal( "Can't fork: $!" );
|
Fatal("Can't fork: $!");
|
||||||
}
|
}
|
||||||
} # end if ! server is up
|
} # end if ! server is up
|
||||||
|
|
||||||
if ( $command eq 'check' && ! $daemon ) {
|
if ( ($command eq 'check') && !$daemon ) {
|
||||||
print( "running\n" );
|
print("running\n");
|
||||||
exit();
|
exit();
|
||||||
} elsif ( $command eq 'startup' ) {
|
} elsif ( $command eq 'startup' ) {
|
||||||
# Our work here is done
|
# Our work here is done
|
||||||
exit() if ( !$server_up );
|
exit() if !$server_up;
|
||||||
}
|
}
|
||||||
|
|
||||||
# The server is there, connect to it
|
# The server is there, connect to it
|
||||||
#print( "Writing commands\n" );
|
#print( "Writing commands\n" );
|
||||||
CLIENT->autoflush();
|
CLIENT->autoflush();
|
||||||
my $message = join(';', $command, ( $daemon ? $daemon : () ), @args );
|
my $message = join(';', $command, ( $daemon ? $daemon : () ), @args );
|
||||||
print( CLIENT $message );
|
print(CLIENT $message);
|
||||||
shutdown( CLIENT, 1 );
|
shutdown(CLIENT, 1);
|
||||||
while( my $line = <CLIENT> ) {
|
while( my $line = <CLIENT> ) {
|
||||||
chomp( $line );
|
chomp($line);
|
||||||
print( "$line\n" );
|
print("$line\n");
|
||||||
}
|
}
|
||||||
# And we're done!
|
# And we're done!
|
||||||
close( CLIENT );
|
close(CLIENT);
|
||||||
#print( "Finished writing, bye\n" );
|
#print( "Finished writing, bye\n" );
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
@ -344,9 +344,9 @@ sub run {
|
||||||
} else {
|
} else {
|
||||||
dPrint( ZoneMinder::Logger::ERROR, "Invalid command '$command'\n" );
|
dPrint( ZoneMinder::Logger::ERROR, "Invalid command '$command'\n" );
|
||||||
}
|
}
|
||||||
close( CLIENT );
|
close(CLIENT);
|
||||||
} else {
|
} else {
|
||||||
Fatal( 'Bogus descriptor' );
|
Fatal('Bogus descriptor');
|
||||||
}
|
}
|
||||||
} elsif ( $nfound < 0 ) {
|
} elsif ( $nfound < 0 ) {
|
||||||
if ( $! == EINTR ) {
|
if ( $! == EINTR ) {
|
||||||
|
@ -355,9 +355,9 @@ sub run {
|
||||||
# See if it needs to start up again
|
# See if it needs to start up again
|
||||||
restartPending();
|
restartPending();
|
||||||
} elsif ( $! == EPIPE ) {
|
} elsif ( $! == EPIPE ) {
|
||||||
Error( "Can't select: $!" );
|
Error("Can't select: $!");
|
||||||
} else {
|
} else {
|
||||||
Fatal( "Can't select: $!" );
|
Fatal("Can't select: $!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#print( "Select timed out\n" );
|
#print( "Select timed out\n" );
|
||||||
|
@ -566,19 +566,19 @@ sub restart {
|
||||||
|
|
||||||
my $command = $daemon;
|
my $command = $daemon;
|
||||||
$command .= ' '.join( ' ', ( @args ) ) if @args;
|
$command .= ' '.join( ' ', ( @args ) ) if @args;
|
||||||
dPrint ( ZoneMinder::Logger::WARNING, "Restarting $command\n");
|
dPrint ( ZoneMinder::Logger::DEBUG, "Restarting $command\n");
|
||||||
my $process = $cmd_hash{$command};
|
my $process = $cmd_hash{$command};
|
||||||
if ( $process ) {
|
if ( $process ) {
|
||||||
dPrint ( ZoneMinder::Logger::WARNING, "Have process" );
|
dPrint( ZoneMinder::Logger::DEBUG, "Have process" );
|
||||||
if ( $process->{pid} ) {
|
if ( $process->{pid} ) {
|
||||||
dPrint ( ZoneMinder::Logger::WARNING, "Have process pid " .$process->{pid} );
|
dPrint( ZoneMinder::Logger::DEBUG, "Have process pid " .$process->{pid} );
|
||||||
my $cpid = $process->{pid};
|
my $cpid = $process->{pid};
|
||||||
if ( defined($pid_hash{$cpid}) ) {
|
if ( defined($pid_hash{$cpid}) ) {
|
||||||
dPrint ( ZoneMinder::Logger::WARNING, "Have process pid hash " .$process->{pid} );
|
dPrint( ZoneMinder::Logger::DEBUG, "Have process pid hash " .$process->{pid} );
|
||||||
_stop( 0, $process );
|
_stop( 0, $process );
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
dPrint ( ZoneMinder::Logger::WARNING, "Not sending stop" );
|
dPrint( ZoneMinder::Logger::DEBUG, "Not sending stop" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue