I’ve put together a quick workaround for a long-standing problem with my server, whereby every so often my mailserver will crash (usually every week or so). I discovered the problem relates to amavis crashing – but as yet I have not found a solution to the problem.
The shell script I’ve put together below (with the help of this) checks the status of the amavis service. If it’s down, the script will bring it back up and then restart postfix to resume deliveries.
I’d suggest running the script every 5 minutes from a cron job (use crontab -e to modify to your cron jobs).
# Author: Alex Ward
# This script was created to find workaround to a problem where postfix would fail
# if amavis stopped on ISPConfig / Debian. This simple script will check the
# uptime of amavis and, if it is down, start it and then restart postfix.
# This script can be set up in a crontab.
# Built with help from
#Changelog: Implemented version number and prepared for crontab logging.
echo ‘MAILSERVER SYSTEM CHECKUP!’
echo “Version: $version”
echo “Checking $service status…”
if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
echo “$service is running! No action required.”
echo “$service is DOWN! Rectifying this…”
You can download a copy of the script here (right click, save as).
It isn’t a solution to the problem – but until I find the solution, this will at least stop the problem from killing off mail deliveries.