Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
                    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?

share|improve this question
    
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. –  Andrzej A. Filip May 2 '13 at 15:59
    
Don't have it anymore, but you've answered what I need to look at. –  octopusgrabbus May 2 '13 at 19:34
add comment

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
The message wasn't locked. The pid was locked. I've edited the OP to include the message the bot sends me. root sends the message. An account named dbadmin gets the message. While that message sits in the queue, root can send as many emails as it likes to dbadmin, and they go through. –  octopusgrabbus May 3 '13 at 12:34
    
man mailq: The status characters are either * to indicate the job is being processed;. I call messages with * locked. Add ps report to your mailq report. [Sendmail processes change their ps visible data] –  Andrzej A. Filip May 5 '13 at 4:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.