From db864eea1adccadeb1c81f9db251520b47c41c35 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sat, 25 Apr 2020 11:48:44 +0200 Subject: [PATCH] install_update_dovecot.sh: in case of updating, stop dovecot after compiling new sources but before installing new sources. --- install_update_dovecot.sh | 51 +++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/install_update_dovecot.sh b/install_update_dovecot.sh index af7fa03..ecef959 100755 --- a/install_update_dovecot.sh +++ b/install_update_dovecot.sh @@ -685,33 +685,14 @@ fi -## ----------------- -## --- Stop dovecot if running - -echononl "\tStop dovecot service.." -if ps ax 2> /dev/null | grep -q -E "/usr/local/dovecot[0-9.-]*/sbin/dovecot" > /dev/null 2>&1 ; then - if $systemd_support ; then - systemctl stop dovecot > /dev/null 2>&1 - else - /etc/init.d/dovecot stop > /dev/null 2>&1 - fi - if [ "$?" = 0 ]; then - echo -e "$rc_done" - else - echo -e "$rc_failed" - error "Stopping dovecot service failed" - fi -else - echo -e "$rc_skipped" -fi - - ## ----------------- ## --- Install Base System echo "" echo "Installing Base System.." +## - Unpack dovecot sources +## - cd ${_src_base_dir} echononl "\tUnpack dovecot-${_version}.tar.gz.." tar -xzf dovecot-${_version}.tar.gz > /dev/null @@ -724,6 +705,8 @@ fi cd dovecot-${_version} +## - Configure dovecot +## - config_params=" --prefix=/usr/local/dovecot-${_version} \ --with-${db_driver} \ @@ -752,6 +735,29 @@ else fatal Configuring dovecot failed fi + +## ----------------- +## --- Stop dovecot if running + +echononl "\tStop dovecot service.." +if ps ax 2> /dev/null | grep -q -E "/usr/local/dovecot[0-9.-]*/sbin/dovecot" > /dev/null 2>&1 ; then + if $systemd_support ; then + systemctl stop dovecot > /dev/null 2>&1 + else + /etc/init.d/dovecot stop > /dev/null 2>&1 + fi + if [ "$?" = 0 ]; then + echo -e "$rc_done" + else + echo -e "$rc_failed" + error "Stopping dovecot service failed" + fi +else + echo -e "$rc_skipped" +fi + +## - Compile dovecot +## - echononl "\tCompile Dovecot Sources.." make > ${_log_dir}/dovecot-${_version}-make.log 2>&1 || clean_up 1 if [ "$?" = 0 ]; then @@ -760,6 +766,9 @@ else echo -e "$rc_failed" fatal Compiling dovecot failed fi + +## - Install dovecot +## - echononl "\tInstall Dovecot into Folder /usr/local/dovecot-${_version}" make install > ${_log_dir}/dovecot-${_version}-install.log 2>&1 || clean_up 1 if [ "$?" = 0 ]; then