HMoellendorf87
Regular Pleskian
Dear community,
as some customer asked for a solution for monitoring the mail queue on the plesk server, I found one and I think this is in some cases useful. So I try to get a manual written down here, afterwards I will add also pictures.
Requirements
1.) Login via SSH possible
2.) Knowledge about text-editor on your machine
3.) Knowledge about cronjobs
Steps
1. Step
Login to your server using root access.
2. Step
Create a file named check_email_queue.sh by using an text-editor, i.e. vi or nano and switch to INSERT mode (in vi)
3. Step
Fill in the following code:
The bold parameters have to be edited to your information and requirement.
Save the file and quit your editor
4. Step
Now you have to setup your cronjob using the following command:
5. Step
Enter the following line and adapt the aquired time to run your crontab requirements:
This script runs now every 5 minutes and checks your mail queue and will inform you via mail as soon the mail queue limit exceeds.
Thanks to MislavOhttp://forum.parallels.com/member.php?131175-MislavO.
Any questions or feature requests are appreciated.
as some customer asked for a solution for monitoring the mail queue on the plesk server, I found one and I think this is in some cases useful. So I try to get a manual written down here, afterwards I will add also pictures.
Requirements
1.) Login via SSH possible
2.) Knowledge about text-editor on your machine
3.) Knowledge about cronjobs
Steps
1. Step
Login to your server using root access.
2. Step
Create a file named check_email_queue.sh by using an text-editor, i.e. vi or nano and switch to INSERT mode (in vi)
3. Step
Fill in the following code:
#!/bin/bash
# get server hostname
hostname=`cat /etc/hostname`
current_mailq=`postqueue -p | tail -n 1 | cut -d' ' -f5`
yourEmail="[email protected]"
if [ "$current_mailq" -gt "100" ]
then
echo "Mail queue problem - there is currently $current_mailq mails in queue. Please check it out." > check_email_queue_outgoing.txt
mail -s "$hostname - mail queue alert - there are $current_mailq emails in queue" "$yourEmail" < check_email_queue_outgoing.txt
else
echo "Mail queue is fine - there is currently $current_mailq mails in queue. Please check it out."
echo "Do nothing, situation is fine."
fi
The bold parameters have to be edited to your information and requirement.
Save the file and quit your editor
4. Step
Now you have to setup your cronjob using the following command:
crontab -e
5. Step
Enter the following line and adapt the aquired time to run your crontab requirements:
*/5 * * * * cd /home/user/ && ./check_email_queue.sh
This script runs now every 5 minutes and checks your mail queue and will inform you via mail as soon the mail queue limit exceeds.
Thanks to MislavOhttp://forum.parallels.com/member.php?131175-MislavO.
Any questions or feature requests are appreciated.
Last edited: