Back to articles
Keep It Running: Email Keep It Running: Email Infrastructure Operations Guide
How-ToDevOps

Keep It Running: Email Keep It Running: Email Infrastructure Operations Guide

via Dev.to DevOpsCyril Sebastian

Making email infrastructure a pro. Daily Operations (5 Minutes) The Morning Health Check Create this script and run it daily: cat > ~/email-health.sh << ' EOF ' #!/bin/bash YESTERDAY= $( date -d "yesterday" + "%b %d" ) echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "Email Health ( $YESTERDAY )" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━" # Service status systemctl is-active --quiet postfix && echo "Postfix" || echo "Postfix DOWN" systemctl is-active --quiet ses-logger && echo "Logger" || echo "Logger DOWN" # Email stats SENT= $( grep " $YESTERDAY " /var/log/postfix/postfix.log 2>/dev/null | grep -c "status=sent" ) DELIVERED= $( grep " $YESTERDAY " /var/log/postfix/mail.log 2>/dev/null | grep -c "status=delivered" ) BOUNCED= $( grep " $YESTERDAY " /var/log/postfix/mail.log 2>/dev/null | grep -c "status=bounced" ) echo "" echo "📊 Volume" echo " Sent: $SENT " echo " Delivered: $DELIVERED " echo " Bounced: $BOUNCED " if [ $SENT -gt 0 ]; then DELIVERY_RATE= $(( DELIVERED * 100 / SENT )) BOUNCE_RATE= $((

Continue reading on Dev.to DevOps

Opens in a new tab

Read Full Article
2 views

Related Articles