From 4ca40b79c041b90c49359ac92a5d9474e22d8714 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Fri, 4 Sep 2020 10:02:36 -0700 Subject: [PATCH] When restarting, also use the flag file as a backup, as on CentOS 8 sometimes signals don't get processed --- web-lib-funcs.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web-lib-funcs.pl b/web-lib-funcs.pl index f218f91ae..1ebf11e3c 100755 --- a/web-lib-funcs.pl +++ b/web-lib-funcs.pl @@ -2126,6 +2126,7 @@ if ($main::webmin_script_type eq 'web' && !$ENV{"MINISERV_CONFIG"} && } my $i; +my $flag = $miniserv{'restartflag'} || $var_directory."/restart-flag"; if ($gconfig{'os_type'} ne 'windows') { # On Unix systems, we can restart with a signal my ($pid, $addr, $i); @@ -2152,10 +2153,13 @@ if ($gconfig{'os_type'} ne 'windows') { } } - # Just signal miniserv to restart + # Just signal miniserv to restart, and also create the flag file in + # case signals aren't being processed if (!&kill_logged('HUP', $pid)) { &error("Incorrect Webmin PID $pid") if (!$ignore); } + open(TOUCH, ">$flag"); + close(TOUCH); # Wait till new PID is written, indicating a restart for($i=0; $i<60; $i++) { @@ -2172,7 +2176,7 @@ if ($gconfig{'os_type'} ne 'windows') { } else { # On Windows, we need to use the flag file - open(TOUCH, ">$miniserv{'restartflag'}"); + open(TOUCH, ">$flag"); close(TOUCH); }