mirror of
https://git.myvelabs.com/docker/myvemail.git
synced 2025-12-17 21:26:19 +00:00
Moved email rejects to its own file
This commit is contained in:
parent
fec2a97ccc
commit
008d6ac4ad
2 changed files with 20 additions and 15 deletions
|
|
@ -24,21 +24,6 @@ do
|
|||
sleep 7d
|
||||
done &
|
||||
|
||||
# Notify if rejected emails were found
|
||||
while true
|
||||
do
|
||||
bash -c 'tail -n +0 --pid=$$ -f /var/log/mail/maillog* | grep --line-buffered -F -v -f /var/log/mail/reject.log | { sed "/NOQUEUE: reject/q" && kill $$ ;}'
|
||||
echo "$(grep "NOQUEUE: reject" /var/log/mail/maillog* | grep -F -v -f /var/log/mail/reject.log)" >>/var/log/mail/reject.log
|
||||
cat <<- mail | sendmail reject@${MYVEMAIL_DOMAIN}
|
||||
From: reject@${MYVEMAIL_DOMAIN}
|
||||
To: reject@${MYVEMAIL_DOMAIN}
|
||||
Subject: Rejected email found
|
||||
|
||||
$(tail -n 1 /var/log/mail/reject.log)
|
||||
mail
|
||||
done &
|
||||
|
||||
|
||||
# # Refresh ssl keys daily
|
||||
# # https://www.golinuxcloud.com/renew-self-signed-certificate-openssl/
|
||||
# while true
|
||||
|
|
|
|||
20
build/run/docker-entrypoint/init.d/70-reject.sh
Executable file
20
build/run/docker-entrypoint/init.d/70-reject.sh
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
# Notify if rejected emails were found
|
||||
function monitor-rejects
|
||||
{
|
||||
while true
|
||||
do
|
||||
bash -c 'tail -n +0 --pid=$$ -f /var/log/mail/maillog* | grep --line-buffered -F -v -f /var/log/mail/reject.log | { sed "/NOQUEUE: reject/q" && kill $$ ;}'
|
||||
local reject="$(grep "NOQUEUE: reject" /var/log/mail/maillog* | grep -F -v -f /var/log/mail/reject.log)"
|
||||
echo ${reject} >>/var/log/mail/reject.log
|
||||
cat <<- mail | sendmail reject@${MYVEMAIL_DOMAIN}
|
||||
From: reject@${MYVEMAIL_DOMAIN}
|
||||
To: reject@${MYVEMAIL_DOMAIN}
|
||||
Subject: Rejected email found
|
||||
|
||||
${reject}
|
||||
mail
|
||||
done
|
||||
}
|
||||
|
||||
monitor-rejects &
|
||||
Loading…
Add table
Add a link
Reference in a new issue