If we are starting a process that is waiting to term, mark it to get started by the reaper. Fixes case where zmdc thought the process was still running and so didn't start it. We never noticed because zmwatch would eventually notice. The result is instant restart.
This commit is contained in:
parent
5adf5dab50
commit
afc21cd14d
|
@ -429,10 +429,20 @@ sub start {
|
||||||
# It's not running, or at least it's not been started by us
|
# It's not running, or at least it's not been started by us
|
||||||
$process = { daemon=>$daemon, args=>\@args, command=>$command, keepalive=>!undef };
|
$process = { daemon=>$daemon, args=>\@args, command=>$command, keepalive=>!undef };
|
||||||
} elsif ( $process->{pid} && $pid_hash{$process->{pid}} ) {
|
} elsif ( $process->{pid} && $pid_hash{$process->{pid}} ) {
|
||||||
dPrint(ZoneMinder::Logger::INFO, "'$process->{command}' already running at "
|
if ($process->{term_sent_at}) {
|
||||||
|
dPrint(ZoneMinder::Logger::INFO, "'$process->{command}' was told to term at "
|
||||||
|
.strftime('%y/%m/%d %H:%M:%S', localtime($process->{term_sent_at}))
|
||||||
|
.", pid = $process->{pid}\n"
|
||||||
|
);
|
||||||
|
$process->{keepalive} = !undef;
|
||||||
|
$process->{delay} = 0;
|
||||||
|
delete $terminating_processes{$command};
|
||||||
|
} else {
|
||||||
|
dPrint(ZoneMinder::Logger::INFO, "'$process->{command}' already running at "
|
||||||
.strftime('%y/%m/%d %H:%M:%S', localtime($process->{started}))
|
.strftime('%y/%m/%d %H:%M:%S', localtime($process->{started}))
|
||||||
.", pid = $process->{pid}\n"
|
.", pid = $process->{pid}\n"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,7 +533,7 @@ sub send_stop {
|
||||||
."\n"
|
."\n"
|
||||||
);
|
);
|
||||||
sigprocmask(SIG_UNBLOCK, $blockset) or die "dying at unblock...\n";
|
sigprocmask(SIG_UNBLOCK, $blockset) or die "dying at unblock...\n";
|
||||||
return();
|
return ();
|
||||||
}
|
}
|
||||||
|
|
||||||
my $pid = $process->{pid};
|
my $pid = $process->{pid};
|
||||||
|
@ -586,7 +596,7 @@ sub check_for_processes_to_kill {
|
||||||
|
|
||||||
sub stop {
|
sub stop {
|
||||||
my ( $daemon, @args ) = @_;
|
my ( $daemon, @args ) = @_;
|
||||||
my $command = join(' ', $daemon, @args );
|
my $command = join(' ', $daemon, @args);
|
||||||
my $process = $cmd_hash{$command};
|
my $process = $cmd_hash{$command};
|
||||||
if ( !$process ) {
|
if ( !$process ) {
|
||||||
dPrint(ZoneMinder::Logger::WARNING, "Can't find process with command of '$command'");
|
dPrint(ZoneMinder::Logger::WARNING, "Can't find process with command of '$command'");
|
||||||
|
|
Loading…
Reference in New Issue