This repository has been archived on 2026-09-10. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
taler-monitoring/host-agent/run-mail-deliv-probe.sh
2026-09-08 01:39:31 +02:00

40 lines
1.4 KiB
Bash
Executable file

#!/usr/bin/env bash
# Regular mon* inbox-vs-spam probe (Taler deliverability sinks).
# Timer: taler-monitoring-mail-deliv.timer (default every 6h).
#
# Loads secrets.env if present. Does NOT print passwords.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
if [[ -d /home/hernani/src/taler-monitoring ]]; then
ROOT=/home/hernani/src/taler-monitoring
fi
cd "$ROOT"
# secrets (gitignored)
for f in \
"${TALER_MONITORING_ENV:-}" \
"$HOME/.config/taler-monitoring/env" \
"$ROOT/secrets.env" \
"$HOME/src/taler-monitoring-env/secrets.env"
do
[[ -n "$f" && -f "$f" ]] || continue
set -a
# shellcheck disable=SC1090
source "$f"
set +a
break
done
export MAIL_DELIV_PROBE_FROM="${MAIL_DELIV_PROBE_FROM:-mon001@hacktivism.ch}"
export MAIL_DELIV_PROBE_TO="${MAIL_DELIV_PROBE_TO:-mon001@hacktivism.ch mon002@hacktivism.ch mon003@hacktivism.ch}"
export MAIL_DELIV_PROBE_SMTP="${MAIL_DELIV_PROBE_SMTP:-mail.cyon.ch:587}"
export MAIL_DELIV_IMAP_HOST="${MAIL_DELIV_IMAP_HOST:-mail.cyon.ch}"
export MAIL_DELIV_PROBE_WAIT_S="${MAIL_DELIV_PROBE_WAIT_S:-45}"
export MAIL_DELIV_PROBE_ALERT_TO="${MAIL_DELIV_PROBE_ALERT_TO:-hernani+mon@taler-systems.com hernani+mon@vecirex.net vecirex+mon@icloud.com fdold+mon@taler.net}"
if [[ -z "${MAIL_DELIV_IMAP_PASS:-}${MAIL_DELIV_ALERT_PASS:-}" ]]; then
echo "run-mail-deliv-probe: no MAIL_DELIV_IMAP_PASS in env/secrets.env" >&2
exit 2
fi
exec python3 "$ROOT/mail_deliv_probe.py"