Author: .daniel.schrock
Date: 22-07-02 21:15
My mail server is running Qmail/Vpopmail and my users home directories, as well as the vpopmail directory, are nfs mounted.
This has been very successful so far, but one thing has caused problems...
When the clearopensmtp cronjob runs, it floods my mailbox (which is not nfs mounted- I use local home dirs for admins) with cron errors if i'm doing something with fileserver and /home is not mounted.
In order to maintain the functionality of the job, but reduce the notification frequency, I created a script that some of you may be interested in.
<b>/admin/bin/vpopclear.sh :</b>
#!/bin/sh
<b>#Set up the initial variables</b>
BASEDIR=/home/vpopmail
BINDIR=${BASEDIR}/bin
EXECARGS='2>&1 > /dev/null'
TESTFILE=/tmp/nohome
ALERTFILE=/tmp/pagermailed
PAGEADDR='<emailaddress>'
<b>#Test for the vpopmail directory</b>
if [ -d ${BASEDIR} ]; then
<b>#if found, test if was missing last time it ran and remove</b>
if [ -f ${TESTFILE} ]; then
rm ${TESTFILE}
rm ${ALERTFILE}
fi
<b>#run the clearopensmtp process</b>
${BINDIR}/clearopensmtp ${EXECARGS}
exit 0
else
<b>#otherwise, check for the /tmp/nohome file. exit if it is found... we've already be notified</b>
if [ -f ${TESTFILE} ]; then
exit 0
else
<b>#notify us that /home is not mounted and clearopensmtp can't run.</b>
/usr/bin/mail -s '/home not mounted!' $PAGEADDR << EOF
ClearOpenSMTP unable to run!
EOF
touch ${TESTFILE}
touch ${ALERTFILE}
exit 0
fi
fi
Then modify your crontab to reflect the new script:
# vpop maintenance
#9-59,10 * * * * root /home/vpopmail/bin/clearopensmtp 2>&1 > /dev/null
9-59,10 * * * * root /admin/bin/vpopclear.sh
Feel free to modify this script to your liking.
Let me know of any ideas/suggestions you may have to make it better.
|
|