• The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Shell script for checking mail queue

N

NightMan

Guest
Hi
I have created/modified a following script to monitor the qmail queue. it is working fine on our servers. it will mail you, when the amount of mails in local or remote queue execeeding the limit you set in the script.
note: you need to install the qmHandle in the server to use this script.

create a file in the server called e.g mailcheck.sh then chmod it to 755.
modify the script as you wish and save the file. then add it to the cron to run every hour.

#!/bin/bash
qlimit_local=100;
qlimit_remote=1000;
[email protected];
servername='YOURSERVER.COM';

count_remote=`./qmHandle -s | grep "remote queue" | awk -F ":" '{print $2}' | sed 's/ //g'`;
count_local=`./qmHandle -s | grep "local queue" | awk -F ":" '{print $2}' | sed 's/ //g'`;

if [ $count_remote -ge $qlimit_remote ] | [ $count_local -ge $qlimit_local ]; then

mail $notifyemail -s 'Mailqueue limit exceeding - '$servername<<EOF
Dear Server admin,

We have $count_local in local mailqueue.
We have $count_remote in remote mailqueue.
EOF
fi
#-------- SCRIPT END HERE ------------
 
one question

hello

this sounds really usefull... but i ran across this similar post:

http://www.unix.com/shell-programmi...-script-needed-mail-queue-notification-2.html

where this point is expressed:

"If there is queue, and you report about this queue by sending an email, that email will be last in queue.

By the time it will be send it will report about emails in queue which are no longer in queue since they are send prior to your status email."

is this true with your script?
thanks!
 
hello

this sounds really usefull... but i ran across this similar post:

http://www.unix.com/shell-programmi...-script-needed-mail-queue-notification-2.html

where this point is expressed:

"If there is queue, and you report about this queue by sending an email, that email will be last in queue.

By the time it will be send it will report about emails in queue which are no longer in queue since they are send prior to your status email."

is this true with your script?
thanks!

Yes. it is correct. but normally the mail will reach you before the queue get delivered. if you run the script every 5 min. your status mail will get in to the queue and delivert to you. in this case, there will be more mails comming to queue even after you received the mails. so you will be able to login to the server and investicate and stop the spam mails. it is running on all my servers. and really helped me every time.
but you can actually edit this script to call a php script in a external server to send an email instantly. so you will overcome this mail queue issue.
 
Back
Top