From c5d8530ebcbf389290cd3ba7eccc70cf7d6f3698 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sat, 23 May 2020 12:55:35 -0700 Subject: [PATCH] Use HUP signal to apply Dovecot config --- dovecot/dovecot-lib.pl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dovecot/dovecot-lib.pl b/dovecot/dovecot-lib.pl index 5ea1510bd..c63fa0c11 100755 --- a/dovecot/dovecot-lib.pl +++ b/dovecot/dovecot-lib.pl @@ -367,12 +367,17 @@ local $out = &read_file_contents($temp); return &is_dovecot_running() ? undef : "
$out
"; } -# apply_configration() -# Stop and re-start the Dovecot server +# apply_configration([full-restart]) +# Reload the Dovecot configuration, optionally with a full restart sub apply_configuration { +local ($restart) = @_; local $pid = &is_dovecot_running(); -if ($pid) { +if (!$pid) { + return $text{'stop_erunning'}; + } +elsif ($restart) { + # Fully shut down and re-start &stop_dovecot(); local $err; for(my $i=0; $i<5; $i++) { @@ -383,7 +388,8 @@ if ($pid) { return $err; } else { - return $text{'stop_erunning'}; + # Send the HUP signal + return &kill_logged('HUP', $pid) ? undef : $!; } }