#!/bin/bash # Scan last 20 lines of /var/log/maillog for the amavis BDB error if tail -n 20 /var/log/maillog | grep -q "DB_VERSION_MISMATCH"; then exit 1 # error found else exit 0 # no error fi