check_sympa_spool_msg_dir.sh: some changes to the script output.

This commit is contained in:
Christoph 2022-10-17 12:27:22 +02:00
parent 67063f7702
commit 57efdc4175

View File

@ -78,7 +78,7 @@ warn (){
info (){
if $terminal ; then
echo ""
echo -e " [ \033[32m\033[1mInfo\033[m ] $*"
echo -e " [ \033[32m\033[1mInfo\033[m ]: $*"
echo ""
fi
}
@ -361,7 +361,17 @@ if [[ ${#potential_critical_msg_file[@]} -lt 1 ]] ; then
\033[1mAll is fine.\033[m - Script ends here."
if [[ -d "${TMP_SPOOL_MSG_DIR}" ]] ; then
rm -rf "${TMP_SPOOL_MSG_DIR}"
if ! $terminsl ; then
echo ""
echo -e " [ Info ]: No critical message(s) in folder '${SYMPA_SPOOL_MSG_DIR}' found.
."
echo ""
fi
fi
clean_up 0
else
blank_line
@ -420,6 +430,7 @@ if $terminal ; then
echo ""
fi
_found_file_second_time=false
if ! $tmp_spool_msg_folder_exists ; then
for _file in ${potential_critical_msg_file[@]} ; do
echononl "Copy file \033[1m${_file}\033[m into ${TMP_SPOOL_MSG_DIR}.."
@ -433,10 +444,9 @@ if ! $tmp_spool_msg_folder_exists ; then
fi
done
clean_up 0
fi
#clean_up 0
else
_found_file_second_time=false
for _file in ${potential_critical_msg_file[@]} ; do
if containsElement "$_file" "${tmp_potential_critical_msg_file[@]}" ; then
@ -480,7 +490,21 @@ for _file in ${potential_critical_msg_file[@]} ; do
fi
done
fi
if ! $_found_file_second_time ; then
if $terminal ; then
blank_line
info "Right now there is nothing more to do as the critical files have been found for the first time."
else
echo ""
echo -e " [ Info ]: Right now there is nothing more to do as the critical files have been found
for the first time."
echo ""
fi
else
# ----------
# - Some post-script tasks ..
@ -491,6 +515,10 @@ if $terminal ; then
echo ""
echo -e " \033[1mDoing some post-script tasks ..\033[m"
echo ""
else
echo ""
echo -e " [ Info ]: Critical files have been removed from the spool directory. '${SYMPA_SPOOL_MSG_DIR}'"
echo ""
fi
@ -502,19 +530,15 @@ if $(is_empty_directory "${TMP_SPOOL_MSG_DIR}") ; then
rmdir "${TMP_SPOOL_MSG_DIR}" > $log_file 2>&1
if [[ $? -lt 1 ]] ; then
echo_done
else
echo_failed
error "$(cat $log_file)"
fi
if $terminal ; then
echononl "Try to (re)start sympa service.."
else
echo_skipped
warn "Directory \033[1m${TMP_SPOOL_MSG_DIR}\033[m is not empty!"
echo ""
echo " [ Info ]: Try restarting sympa service now.."
echo ""
fi
if $_found_file_second_time ; then
echononl "Try to (ee)start sympa service.."
systemctl restart sympa > $log_file 2>&1
#systemctl restart sympa > $log_file 2>&1
if [[ $? -lt 1 ]] ; then
echo_done
else
@ -522,6 +546,24 @@ if $_found_file_second_time ; then
error "$(cat $log_file)"
fi
else
echo_failed
error "$(cat $log_file)"
fi
else
echo_skipped
if $terminal ; then
warn "Directory \033[1m${TMP_SPOOL_MSG_DIR}\033[m is not empty!"
else
echo ""
echo " [ Warn ]: Directory '${TMP_SPOOL_MSG_DIR}' is not empty.
Now, awaiting next run of this script.."
echo ""
fi
fi
fi