This repository has been archived on 2024-11-01. You can view files and clone it, but cannot push or open issues or pull requests.
services/healthcheck/data/mail

21 lines
488 B
Text
Raw Normal View History

2022-11-28 18:27:37 +00:00
#!/usr/bin/sh
2023-12-08 15:20:13 +00:00
# Reduce pings to 60 minutes
[ $(date +'%M') -eq '00' ] || exit
2022-11-28 18:27:37 +00:00
cd /opt/ || exit
2023-11-19 04:59:30 +00:00
hc_url="https://hc-ping.com/$MAIL_HC_UID"
alias curl_hc='curl -LA "$USER_AGENT" --retry 3'
2022-11-28 18:27:37 +00:00
envsubst < template.msmtprc > /tmp/msmtprc
envsubst < mailcheck.template.mail > /tmp/mailcheck.mail
2023-11-19 04:59:30 +00:00
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