LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-19-2009, 11:29 AM   #1
Zeno McDohl
Member
 
Registered: Apr 2005
Location: Saratoga, NY
Distribution: Slackware
Posts: 322

Rep: Reputation: 30
Delete certain messages in /var/spool/clientmqueue?


/var/spool/clientmqueue got filled up with a ton of messages due to a monitor on Webmin which kept spamming notification emails.

But I still have some valid emails in /var/spool/clientmqueue which need to be sent out.

How can I remove files in /var/spool/clientmqueue that contain say "postmaster"? I assume I would be using grep, but there's a ton of files and I get "Argument list too long" if I try grep/rm together.
 
Old 10-19-2009, 11:37 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
and I get "Argument list too long" if I try grep/rm together
What command do you use?
 
Old 10-19-2009, 11:44 AM   #3
Zeno McDohl
Member
 
Registered: Apr 2005
Location: Saratoga, NY
Distribution: Slackware
Posts: 322

Original Poster
Rep: Reputation: 30
/var/spool/clientmqueue# grep -l postmaster * | xargs rm
-bash: /usr/bin/grep: Argument list too long
 
Old 10-23-2009, 02:02 PM   #4
Zeno McDohl
Member
 
Registered: Apr 2005
Location: Saratoga, NY
Distribution: Slackware
Posts: 322

Original Poster
Rep: Reputation: 30
Well I cleaned it out manually with grep and writing to a file to list them.

I've got some legit mail left in there, but it appears to be stuck. Like I've got some mail in there dated from 2009-10-08 as well as 2009-10-18.

Why aren't they sending? sendmail is running.
 
Old 10-23-2009, 02:25 PM   #5
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by Zeno McDohl View Post
/var/spool/clientmqueue# grep -l postmaster * | xargs rm
-bash: /usr/bin/grep: Argument list too long
Don't use these one-liners, ever. I keep telling people they are trouble, but no one seems to listen. And don't use "xargs", same reason. Do it this way:

Code:
ls -1 | while read fn
do
   if grep -q postmaster "$fn"
   then
      echo "would delete $fn"
      # rm $fn
   fi
done
This script has the advantage that it won't strangle on a long list (because "ls" runs without an argument) and what it does is very easy to understand.

Once you have run the script and are satisfied that it won't delete anything you want to keep, un-comment the commented line.
 
  


Reply



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
how to clear out /var/spool/clientmqueue jerlinuxdude Linux - Software 4 03-29-2012 02:02 AM
Large files in /var/spool/clientmqueue : How do I get sendmail to process them? SupremeUK Linux - Software 5 11-28-2007 06:34 AM
/var/spool/clientmqueue filling up, but never emptying peckert Linux - Software 1 06-01-2006 06:50 AM
sendmail filling /var/spool/clientmqueue/ on FC4 alesz Linux - Networking 0 10-06-2005 02:50 PM
/var/spool/clientmqueue chintanDesai Linux - Software 0 03-22-2004 03:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:00 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration