LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-13-2003, 06:19 PM   #1
glock19
Member
 
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510

Rep: Reputation: 31
Exclamation sendmail, command to flush queue?


I want to know the command that will flush the queue for sendmail?

I type /usr/sbin/sendmail -bp and I get a list of the queue. I don't want any of the messages in this queue to go out, so I need to delete them. What is the command to flush out the existing queue?

Thanks!
 
Old 03-13-2003, 06:35 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
From my understanding there *IS* no such switch...
Stop the demon, go to /var/spool/mqueue and rm
them? :)

Cheers,
Tink
 
Old 03-13-2003, 06:38 PM   #3
glock19
Member
 
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510

Original Poster
Rep: Reputation: 31
Sounds like that's the way to do it.

It's funny, I had so many files in my /var/spool/mqueue that I couldn't rm -f *

I got an error that the rm command couldn't handle that many arguments.

So I had to selectively rm -f dfh7* rm -f Qdh6* etc etc until finally I emptied the directory. Funny.
 
Old 03-13-2003, 09:32 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Ouch ... open port, relaying? ;)

Cheers,
Tink
 
Old 03-14-2003, 04:06 AM   #5
fmotta
LQ Newbie
 
Registered: Mar 2003
Posts: 10

Rep: Reputation: 0
I use a brute force method of
echo "" > /var/spool/mqueue
this can happen quickly - however since I don't get a lot of traffic I don't stop sendmail first - if you do have traffic then it is recommended that you stop/restart sendmail
 
Old 08-12-2003, 08:17 AM   #6
KingRich
LQ Newbie
 
Registered: Aug 2003
Location: Dallas,TX
Distribution: SuSE
Posts: 1

Rep: Reputation: 0
Lightbulb Re: sendmail, command to flush queue?

Try "sendmail -q -v"

Quote:
Originally posted by glock19
I want to know the command that will flush the queue for sendmail?

I type /usr/sbin/sendmail -bp and I get a list of the queue. I don't want any of the messages in this queue to go out, so I need to delete them. What is the command to flush out the existing queue?

Thanks!
 
Old 05-15-2009, 08:32 AM   #7
mmclaughlin
LQ Newbie
 
Registered: Dec 2007
Posts: 3

Rep: Reputation: 0
If you run into a command list too long for rm, try:

# ls /var/spool/mqueue | xargs rm

That will break up the file list into more managable bites for rm.
 
Old 08-06-2009, 12:39 PM   #8
NetSpiderUA
LQ Newbie
 
Registered: Aug 2009
Posts: 2

Rep: Reputation: 0
find /var/spool/mqueue -name "*fn*" -delete
most fastest method =)
 
Old 03-15-2010, 09:54 AM   #9
consmith2
LQ Newbie
 
Registered: Mar 2010
Posts: 1

Rep: Reputation: 0
How can you empty a file?

You can empty the mail file for a user by copying a null file?

In bourne shell:

$ > afile

in C shell

% cp /dev/null afile:

or if you want to "almost" empty a file leaving a few lines:

% tail afile > tmpfile
% cat tmpfile > afile
% rm tmpfile

Last edited by consmith2; 03-15-2010 at 12:12 PM.
 
Old 11-18-2010, 04:47 AM   #10
ritikaladdha
LQ Newbie
 
Registered: Nov 2010
Posts: 1

Rep: Reputation: 0
Pushing the mails in mqueue

Hi,

I have around 1000 mails queued up in Nagios /var/spool/mqueue.
I don't want to miss out on any mails.
Is there a way I can push these mails out instead of rm -rf * ? ?

Regards,
Ritika
 
Old 11-18-2010, 11:23 PM   #11
NetSpiderUA
LQ Newbie
 
Registered: Aug 2009
Posts: 2

Rep: Reputation: 0
i'm using this script to delete selected e-mails:

Code:
#!/bin/sh

for QF in `ls qf*`
do
  blacklisted=`grep "could not send" $QF`
  if [ "$blacklisted" = "" ]
  then
    # trying to resend GOOD letter:
    echo `sendmail -v -qI$QF -d11`
  else
    # permanently deleting BAD letter:
    body=`echo $QF | sed 's/qf/df/'`
    rm $body
    rm $QF
  fi
done
"could not send" - change to any "unwanted text in e-mail".

N.B.
df_LETTER_ID - body of the letter
qf_LETTER_ID - header of the letter

Last edited by NetSpiderUA; 11-18-2010 at 11:40 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
flush my swap/ram? command? lefty.crupps Linux - General 34 04-02-2011 12:59 AM
sendmail: what does it mean if there is no queue file? Thinking Programming 2 11-04-2005 03:10 AM
how to reload sbp2 module /Flush terminal command cache Lakota Mandriva 1 12-07-2004 02:08 PM
sendmail queue visuelz Linux - Software 0 07-17-2003 11:39 AM
Flushing the Sendmail queue DarkSTech Linux - Networking 1 02-19-2003 07:34 AM


All times are GMT -5. The time now is 09:04 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration