Zimbra mailq notification email [Script-1]
Step: 01
Login as root and create below mentioned script:
Login as root and create below mentioned script:
vi /root/mailq.sh
#!/bin/bash
mailq_count="$(/opt/zimbra/common/sbin/mailq | /usr/bin/tail -n1 | /usr/bin/gawk '{print $5}')"
# If variable is empty, then the queue is empty -> set it to zero
if [ -z "$mailq_count" ]; then
mailq_count=0
#echo "Mail queue count on mail.domain.com is ${mailq_count}" | /opt/zimbra/common/sbin/sendmail imsilsa26112@gmail.com
fi
if [ "$mailq_count" -gt 10 ]; then
echo "Mail queue count on mail.domain.com is ${mailq_count}" | /opt/zimbra/common/sbin/sendmail imsilsa26112@gmail.com
fi
Step: 02
#!/bin/bash
mailq_count="$(/opt/zimbra/common/sbin/mailq | /usr/bin/tail -n1 | /usr/bin/gawk '{print $5}')"
# If variable is empty, then the queue is empty -> set it to zero
if [ -z "$mailq_count" ]; then
mailq_count=0
#echo "Mail queue count on mail.domain.com is ${mailq_count}" | /opt/zimbra/common/sbin/sendmail imsilsa26112@gmail.com
fi
if [ "$mailq_count" -gt 10 ]; then
echo "Mail queue count on mail.domain.com is ${mailq_count}" | /opt/zimbra/common/sbin/sendmail imsilsa26112@gmail.com
fi
Step: 02
#chmod +x /root/mailq.sh
Step: 03
#crontab -e
*/15 * * * * /root/mailq.sh
Comments
Post a Comment