What are steps to clear sendmail queue without rebooting

sendmail

                    Begin Note

I believe this is a similar but not duplicate question to another server fault question, because the bounced message is to a legitimate email address that I can send to currently with the bounced message remaining in the queue. That other Server Fault question links me to an answer, rather than provides it within the answer itself, which is something I've been marked down for in the past.

                    End Note

My question is how to I clear a locked sendmail system without rebooting. Here is some background:

I have a Linux Red Hat Enterprise WS 5 server that is solely dedicated to transferring and receiving meter configuration and meter reads information. The server sends a small to moderate amount of email using sendmail.

Linux h2oamr.Somewhereton1.local
2.6.18-348.el5 #1 SMP 
Wed Nov 28 21:22:00 EST 2012 
x86_64 x86_64 x86_64 GNU/Linux

Once a month this little shell script runs as root, and this month, some content came back showing a message was in the queue.

#!/bin/bash
#
# sendmail_alive.sh
# Change History:
# Charles M. Norton 12/13/2010
# Fix header, and add su -l -c to send as amr.

/usr/bin/mailq -v > /tmp/mailq.txt
su -l amr -c \
"mail -s 'sendmail status' dbadmin@town.somewhereton.ma.us < /tmp/mailq.txt"

Here is what my bot sent me:

        /var/spool/mqueue (1 request)
-----Q-ID----- --Size-- -Priority- ---Q-Time--- --------Sender/Recipient--------
r3E822QG016051*    1208      31671 Apr 14 04:02 <root@h2oamr.Somethington.local>
                        <dbadmin@town.somethington.ma.us>
        Total requests: 1

I tried sending email out to the same recipient as that mail stuck in the queue, and it got to that use almost immediately. However, the original stuck message remained in the sendmail queue.

Then, I tried these commands:

sendmail -bm
sendmail -OTimeout.hoststatus=0m -q -v

but kept getting a locked pid message. Unfortunately, I did not preserve the locked .pid message.

Rebooting cleared the problem.

Is it possible to accomplish clearing the queue without rebooting, and, if so, how?

Best Answer

Try to find out "why is the message locked?"

Could you post the relevant sendmail process state as reported by ps? Version for linux-debian: ps auxw | grep sendmail. IMHO you should try to locate which delivery timeout should be reduced.

The most likely suspects: Timeout.connect, Timeout.iconnect.

Related Topic