From 19d4a2287fbb502862a735d8f70da3d4f4f8511c Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 20 Nov 2019 14:22:12 -0500 Subject: [PATCH] When restarting, if the process was already dead, we won't restart it. So add a start call. Fixes #2757 --- scripts/zmdc.pl.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/zmdc.pl.in b/scripts/zmdc.pl.in index 04a5b9952..3a53c03ff 100644 --- a/scripts/zmdc.pl.in +++ b/scripts/zmdc.pl.in @@ -264,6 +264,7 @@ sub run { POSIX::close($fd++); } + # Sets a process group, so that signals to go this and it's children I think setpgrp(); # 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}; if ( $process->{pending} ) { - delete $cmd_hash{$command}; dPrint(ZoneMinder::Logger::INFO, "Command '$command' removed from pending list at " .strftime('%y/%m/%d %H:%M:%S', localtime()) @@ -606,8 +606,11 @@ sub restart { start($daemon, @args); return; } - # Start will be handled by the reaper - send_stop(0, $process); + # Start will be handled by the reaper... + # 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; }