Messaging
cancel
Showing results for 
Search instead for 
Did you mean: 

How to flush contents of /var/spool/mqueue

Kellogg Unix Team
Trusted Contributor

How to flush contents of /var/spool/mqueue

Sendmail Gurus,

I have 2 servers - servera and serverb which are secured by bastille and run "sendmail -q" on periodic basis. In other words, sendmail daemon is not always running.

Serverb has stopped sending mail because of some problem in firewall rules. While it is being looked into, I see the contents of /var/spool/mqueue directory is growing.

Can I move the contents of serverb:/var/spool/mqueue to servera:/var/spool/mqueue and expect all these mails to be delivered successfully? What steps I need to follow after moving the contents to another server? And, what will happen to "From:" field for these messages?

Thanks
...Manjeet
work is fun ! (my manager is standing behind me!!)
6 REPLIES
Robin Wakefield
Honored Contributor

Re: How to flush contents of /var/spool/mqueue

Hi,

If you set the DS line in sendmail.cf on serverb to be servera, then it should send everything to servera, assuming there's no firewall issue between the two. servera should then relay the messages on to the next hop.

The From: field should not change, only the route the message is taking.

rgds, Robin
Kellogg Unix Team
Trusted Contributor

Re: How to flush contents of /var/spool/mqueue

Robin,

Do I need to run sendmail in daemon mode on serverA to accomplish this?

And how do I trigger this? Just by changing DS macro on serverB and when cron runs 'sendmail -q' ? Or can I force it to run immediately?

Other thing that I am not sure is if sendmail traffic is allowed between these servers. I tried "telnet serverA 25" from serverB and it failed with msg - Connection refused.

...Manjeet
work is fun ! (my manager is standing behind me!!)
Uday_S_Ankolekar
Honored Contributor

Re: How to flush contents of /var/spool/mqueue

modify the sendmail.cf file add your serverB name infront of DS flag like this
DSserverb.domain

save and quit sendmail.cf file

restart the sendmail by
/sbin/init.d/sendmail stop
/sbin/init.d/sendmail start

all the queued mails should now move to serverb
look for /var/adm/syslog/mail.log for any errors.


Good Luck..
Geoff Wild
Honored Contributor

Re: How to flush contents of /var/spool/mqueue

Yes - if you want the queue to flush automagically - then you need to run sendmail in daemon mode - or just cron a sendmail -q every 30 minutes....

In the /etc/rc.config.d/mailservs

export SENDMAIL_SERVER=1

Then /sbin/init.d/sendmail start

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Kellogg Unix Team
Trusted Contributor

Re: How to flush contents of /var/spool/mqueue

Setting up DS macro on serverB didn't help. I guess it was looking for sendmail to be running on serverA and I didn't want to leave sendmail running on serverA. Or maybe, its blocked by our firewall.

I ended up tar-ing contents of mqueue directory of serverB and sftp-ing to serverA. I am running the sendmail queue and see that emails are now being sent out.

Thanks for your help.
...Manjeet
work is fun ! (my manager is standing behind me!!)
W.C. Epperson
Trusted Contributor

Re: How to flush contents of /var/spool/mqueue

Yep. Moving the *f* files to another mqueue spool is usually the simplest way to get delivery done while you're troubleshooting. All the header information is in the files, so the only glitch will be that a discrepancy in the Received: headers for outbound relays.
"I have great faith in fools; self-confidence, my friends call it." --Poe