Compare commits
2 Commits
63db4c1317
...
a26b854cca
| Author | SHA1 | Date | |
|---|---|---|---|
| a26b854cca | |||
| 3377e36a2e |
+12
-11
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
script_dir="$(dirname $(realpath $0))"
|
||||
script_dir="$(dirname "$(realpath "$0")")"
|
||||
conf_dir="${script_dir}/conf"
|
||||
conf_file="${conf_dir}/get_mail_domains.conf"
|
||||
|
||||
@@ -30,12 +30,12 @@ DEFAULT_db_name="postfix"
|
||||
clean_up() {
|
||||
|
||||
# Perform program exit housekeeping
|
||||
rm -rf $tmp_dir
|
||||
rm -rf "$tmp_dir"
|
||||
exit $1
|
||||
}
|
||||
echononl(){
|
||||
echo X\\c > /tmp/shprompt$$
|
||||
if [ `wc -c /tmp/shprompt$$ | awk '{print $1}'` -eq 1 ]; then
|
||||
if [ "$(wc -c /tmp/shprompt$$ | awk '{print $1}')" -eq 1 ]; then
|
||||
echo "$*\\c" 1>&2
|
||||
else
|
||||
echo -e -n "$*" 1>&2
|
||||
@@ -77,14 +77,15 @@ trap clean_up SIGHUP SIGINT SIGTERM
|
||||
|
||||
clear
|
||||
echo ""
|
||||
echo -e "\033[32mRunning script \033[1m"$(basename $0)"\033[m .."
|
||||
echo -e "\033[32mRunning script \033[1m$(basename "$0")\033[m .."
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
echononl " Loading default Configuration values from $(basename ${conf_file}).."
|
||||
echononl " Loading default Configuration values from $(basename "${conf_file}").."
|
||||
if [[ ! -f "$conf_file" ]]; then
|
||||
echo_skipped
|
||||
else
|
||||
# shellcheck source=/dev/null
|
||||
source "${conf_file}" > /dev/null 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
@@ -131,7 +132,7 @@ fi
|
||||
echo ""
|
||||
echononl " Collect supported domains at this server.."
|
||||
if [[ "$db_type" = "mysql" ]] ; then
|
||||
domains=$(mysql $mysql_credential_args "$db_name" -N -s -e \
|
||||
domains=$(mysql "$mysql_credential_args" "$db_name" -N -s -e \
|
||||
"SELECT domain FROM domain ORDER by domain" 2> "$log_messages")
|
||||
else
|
||||
domains=$(su - postgres -c"psql \"$db_name\" -t -q -c\"SELECT domain FROM domain ORDER by domain\"")
|
||||
@@ -144,16 +145,16 @@ else
|
||||
clean_up 1
|
||||
fi
|
||||
|
||||
echo -e "\n\n \033[37m\033[1mMail Domains supported by this server ("$(hostname -f)"):\033[m\n"
|
||||
echo "Mail Domains supported by this server ("$(hostname -f)"):" > $out_file
|
||||
echo "" >> $out_file
|
||||
echo -e "\n\n \033[37m\033[1mMail Domains supported by this server ($(hostname -f)):\033[m\n"
|
||||
echo "Mail Domains supported by this server ($(hostname -f)):" > "$out_file"
|
||||
echo "" >> "$out_file"
|
||||
|
||||
for domain in $domains ; do
|
||||
[[ "$domain" = "ALL" ]] && continue
|
||||
echo -e " \033[32m$domain\033[m"
|
||||
echo " $domain" >> $out_file
|
||||
echo " $domain" >> "$out_file"
|
||||
done
|
||||
|
||||
echo "" >> $out_file
|
||||
echo "" >> "$out_file"
|
||||
echo ""
|
||||
clean_up 0
|
||||
|
||||
+7
-5
@@ -57,8 +57,10 @@ set -euo pipefail
|
||||
# - Das sind Regeln “für die Praxis”, keine 100% perfekte Klassifikation.
|
||||
#
|
||||
# 6) Erfolg/Fehlschlag:
|
||||
# - --success zeigt nur erfolgreiche LMTP Outcomes
|
||||
# - --fail zeigt nur nicht-erfolgreiche Outcomes
|
||||
# - --success zeigt nur Outcomes mit status=success
|
||||
# - --fail zeigt nur Outcomes mit status=failed
|
||||
# - Handoff-Einträge (Übergabe an Amavis) werden von beiden Filtern
|
||||
# ausgeblendet, da sie keine endgültige Zustellung darstellen.
|
||||
# - Erfolgreich definieren wir hier pragmatisch als status in:
|
||||
# sent | delivered | deliverable
|
||||
#
|
||||
@@ -116,7 +118,7 @@ Filter:
|
||||
|
||||
Status-Filter:
|
||||
--success nur erfolgreiche Endzustellungen (status=success)
|
||||
--fail nur fehlgeschlagene Endzustellungen (status=failed oder handoff)
|
||||
--fail nur fehlgeschlagene Endzustellungen (status=failed, kein handoff)
|
||||
|
||||
AUTH / Richtung:
|
||||
--sasl-only nur Einlieferungen mit SMTP AUTH (sasl_username vorhanden)
|
||||
@@ -600,8 +602,8 @@ END {
|
||||
if (status == "failed" && msg != "") LAST_FAILURE[qid] = msg
|
||||
|
||||
# Statusfilter
|
||||
if (success_only == 1 && !is_success(status)) next
|
||||
if (fail_only == 1 && is_success(status)) next
|
||||
if (success_only == 1 && status != "success") next
|
||||
if (fail_only == 1 && status != "failed") next
|
||||
|
||||
client = (CLIENT[qid] ? CLIENT[qid] : "-")
|
||||
clientip = (CLIENTIP[qid] ? CLIENTIP[qid] : "-")
|
||||
|
||||
Reference in New Issue
Block a user