When restarting, if the process was already dead, we won't restart it. So add a start call. Fixes #2757

This commit is contained in:
Isaac Connor 2019-11-20 14:22:12 -05:00
parent 0648fbf0ca
commit 19d4a2287f
1 changed files with 6 additions and 3 deletions

View File

@ -264,6 +264,7 @@ sub run {
POSIX::close($fd++); POSIX::close($fd++);
} }
# Sets a process group, so that signals to go this and it's children I think
setpgrp(); setpgrp();
# dbh got closed with the rest of the fd's above, so need to reconnect. # dbh got closed with the rest of the fd's above, so need to reconnect.
@ -513,7 +514,6 @@ sub send_stop {
my $command = $process->{command}; my $command = $process->{command};
if ( $process->{pending} ) { if ( $process->{pending} ) {
delete $cmd_hash{$command}; delete $cmd_hash{$command};
dPrint(ZoneMinder::Logger::INFO, "Command '$command' removed from pending list at " dPrint(ZoneMinder::Logger::INFO, "Command '$command' removed from pending list at "
.strftime('%y/%m/%d %H:%M:%S', localtime()) .strftime('%y/%m/%d %H:%M:%S', localtime())
@ -606,8 +606,11 @@ sub restart {
start($daemon, @args); start($daemon, @args);
return; return;
} }
# Start will be handled by the reaper # Start will be handled by the reaper...
send_stop(0, $process); # unless it was already pending in which case send_stop will return () so we should start it
if ( !send_stop(0, $process) ) {
start($daemon, @args);
}
return; return;
} }