From 033c95c9ce1c93175ce0cbf7b0c439e8db55f2a0 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sun, 12 Mar 2023 23:23:58 +0100 Subject: [PATCH] remove-fatal-errors-in-log-file.sh: stop ppostfix service befor deleting lines. --- remove-fatal-errors-in-log-file.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/remove-fatal-errors-in-log-file.sh b/remove-fatal-errors-in-log-file.sh index 5f7b67e..45e2f6e 100755 --- a/remove-fatal-errors-in-log-file.sh +++ b/remove-fatal-errors-in-log-file.sh @@ -320,6 +320,15 @@ if [[ -n "$_err_msg" ]] ; then echo -e "$_err_msg" echo "" + echononl "Stop postfix mailservice .." + systemctl stop postfix > ${log_file} 2>&1 + if [[ $? -gt 0 ]] ; then + echo_failed + error "$(cat ${log_file})" + else + echo_ok + fi + if $terminal; then echononl "Try to delete lines conatining \033[1mfatal:\033[m in LOG-file \033[1m${MAIL_LOG}\033[m .." else @@ -335,6 +344,14 @@ if [[ -n "$_err_msg" ]] ; then echo_ok fi + echononl "Start postfix mailservice .." + systemctl start postfix > ${log_file} 2>&1 + if [[ $? -gt 0 ]] ; then + echo_failed + error "$(cat ${log_file})" + else + echo_ok + fi else