Improve utils and healthchecks

This commit is contained in:
Tobias Reisinger 2023-11-19 05:59:30 +01:00
parent ccf7f7a598
commit ac40d18f67
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
4 changed files with 33 additions and 14 deletions
healthcheck/data

View file

@ -1,9 +1,17 @@
#!/usr/bin/sh
set -e
cd /opt/ || exit
hc_url="https://hc-ping.com/$MAIL_HC_UID"
alias curl_hc='curl -LA "$USER_AGENT" --retry 3'
envsubst < template.msmtprc > /tmp/msmtprc
envsubst < mailcheck.template.mail > /tmp/mailcheck.mail
msmtp -C /tmp/msmtprc -a default "$MAIL_HC_UID@hc-ping.com" < /tmp/mailcheck.mail
result=$(msmtp -C /tmp/msmtprc -a default "$MAIL_HC_UID@hc-ping.com" < /tmp/mailcheck.mail 2>&1)
if [ "$?" != "0" ]
then
echo "$result"
curl_hc --data-raw "$result" "$hc_url/fail" >/dev/null
fi