Some mail (up to 7 days old) is stuck in

Raymond H Thrush II rthrush at winbeam.com
Thu Jul 27 14:20:40 IST 2006


I have had this happen occasionally, just write a small script to clean 
the ques on demand ie, after an upgrade, or a forced shutdown or crash. 
  You need to check all the ques not just mqueue.
Here is my lame fix I use for such situations.  I have not had success 
getting Mailscanner to start back up from the bash script so you have to 
restart it manually.

Raymond H Thrush II

que_check.sh

--------------------------------------------------------------------------
#!/bin/sh

# Small script to dump que directory listings into three temp files then
# parse each file and do a ls | wc comparison to find and remove orphan
# email files stuck in the que's
# RHT 2006

# Stop Mailscanner

echo " Stopping MailScanner!!! "
/etc/init.d/MailScanner stop

# create temp files
ls /raid/spool/mqueue.in > mqueue.in.temp
ls /raid/spool/mqueue > mqueue.temp
ls /raid/spool/mqueue.out > mqueue.out.temp

# set and clear variables
tdf=0
temptest=0

# start first check mqueue.in

cat mqueue.in.temp | grep df | awk -F'df' '{print $2}' |
while read tdf
do
#       echo $tdf
         temptest=`ls /raid/spool/mqueue.in/*$tdf | wc -l`
#       echo $temptest
         if( `test "$temptest" -lt 2` ); then
                 rm /raid/spool/mqueue.in/*$tdf
                 echo "removed /raid/spool/mqueue.in/*$tdf"
         else
                 continue
         fi
done
# set and clear variables
tdf=0
temptest=0
 

# start second check mqueue
 

cat mqueue.temp | grep df | awk -F'df' '{print $2}' |
while read tdf
do
#       echo $tdf
         temptest=`ls /raid/spool/mqueue/*$tdf | wc -l`
#       echo $temptest
         if( `test "$temptest" -lt 2` ); then
                 rm /raid/spool/mqueue/*$tdf
                 echo "removed /raid/spool/mqueue/*$tdf"
         else
                 continue
         fi
done
# set and clear variables
tdf=0
temptest=0
 

# start third check mqueue.out
 

cat mqueue.out.temp | grep df | awk -F'df' '{print $2}' |
while read tdf
do
#       echo $tdf
         temptest=`ls /raid/spool/mqueue.out/*$tdf | wc -l`
#       echo $temptest
         if( `test "$temptest" -lt 2` ); then
                 rm /raid/spool/mqueue.out/*$tdf
                 echo "removed /raid/spool/mqueue.out/*$tdf"
         else
                 continue
         fi
done
 

echo "Don't Forget to /etc/init.d/MailScanner start"
------------------------------------------------------------------------


 > Tried that. They move right back into /var/spool/mqueue. I've also
 > tried turning off MS and then starting only sendmail (as well as
 > moving the messages). Same effect.
 >
 >
 > Chris.
 >
 >
 > -----Original Message-----
 > From:	Mike Kercher [mailto:mike at vesol.com]
 > Sent:	Wed 7/26/2006 8:31 PM
 > To:	MailScanner discussion
 > Cc:	
 > Subject:	RE: Some mail (up to 7 days old) is stuck in
 > /var/spool/mqueue
 >
 > What would happen if you change your lock to posix, stop MailScanner,
 > COPY the qf/df pairs to /var/spool/mqueue.in and restart MailScanner?
 >
 > Mike
 >
 >
 > > > -----Original Message-----
 > > > From: mailscanner-bounces at lists.mailscanner.info
 > > > [mailto:mailscanner-bounces at lists.mailscanner.info] On Behalf
 > > > Of Chris W. Parker
 > > > Sent: Wednesday, July 26, 2006 9:48 PM
 > > > To: MailScanner discussion
 > > > Subject: RE: Some mail (up to 7 days old) is stuck in
 > > > /var/spool/mqueue
 > > >
 > > > Yes. There is are 23 pairs of emails in /var/spool/mqueue
 > > > (last time I checked a few hours ago).
 > > >
 > > >
 > > > Chris.
 > > >
 > > >
 > > > -----Original Message-----
 > > > From:	derek [mailto:derek at adcatanzaro.com]
 > > > Sent:	Wed 7/26/2006 6:54 PM
 > > > To:	MailScanner discussion
 > > > Cc:	
 > > > Subject:	Re: Some mail (up to 7 days old) is stuck in
 > > > /var/spool/mqueue
 > > >
 > > > Chris W. Parker wrote:
 > >> > > Mike Kercher <mailto:mike at vesol.com>
 > >> > >     on Wednesday, July 26, 2006 2:17 PM said:
 > >> > >
 > >> > >
 > >>> > >> What does mailq say?
 > >>> > >>
 > >> > >
 > >> > > mailq says this:
 > >> > >
 > >> > >                 /var/spool/mqueue (21 requests)
 > >> > > -----Q-ID----- --Size-- -----Q-Time-----
 > >> > > ------------Sender/Recipient-----------
 > >> > > k6JIfxwS020007X  629066 Wed Jul 19 11:41 <mm at ar.com>
 > >> > >                                          <ma at sw.com>
 > >> > >                                          <bd at sw.com>
 > >> > > k6OFsrYc027614X    1303 Mon Jul 24 08:54 <sw at ya.com>
 > >> > >                                          <nd at sw.com>
 > > > k6KF8jTP031339X
 > >> > > 727037 Thu Jul 20 08:08 <tc at sc.com>
 > >> > >                                          <bd at sw.com>
 > > > ---snip---
 > > >
 > > > Have you checked /var/spool/mqueue to make sure there is a
 > > > corresponding "d" and "q" file for the email?
 > > >



More information about the MailScanner mailing list