LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 05-27-2011, 02:09 AM   #1
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
Question find command give error file not found


find /var/spool/mqueue -group abc -exec rm -rf {} \;

Using above command , I delete all the files belong to group abc.

Now the problem i face is that the this command gives error that some files are missing . And this error occur because after creating list of files, it pass that list to rm -rf but till that time sendmail process queue and some of files disapper from /var/spool/mqueue.

Any suggestion to avoid this error message please ..
 
Old 05-27-2011, 02:41 AM   #2
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291
Hello,

I had to look it up since I don't use sendmail, Postfix has the postuser command that takes care of things like you want to do. I think the best way to go is to stop the sendmail daemon first, clean up the queue and start the sendmail daemon again.

Kind regards,

Eric
 
Old 05-27-2011, 02:43 AM   #3
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291
Hello,

Just came across this one on Google: How to clear sendmail queue

Kind regards,

Eric
 
Old 05-28-2011, 06:37 AM   #4
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Original Poster
Rep: Reputation: 66
My question is not sendmail related . I know how to clean sendmail queue . I question is related to find command

Thanks
 
Old 05-28-2011, 07:27 AM   #5
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291
Hi,

You are of course entitled to have a different opinion. I only pointed you to the fact that you are using find to delete specific messages from the sendmail queue and that there are alternatives. I even told you that most likely if you stop the sendmail daemon before beginning the cleanup operation you'll not encounter that error. The find command passes the hits one after another to the rm command so it's not surprising that you encounter errors when running that on a mail queue that's active.

If you know how to clean up the sendmail queue then why are you insisting on using find to delete files from it when the daemon is active?

Kind regards,

Eric
 
Old 05-28-2011, 09:17 AM   #6
networking.dept
Member
 
Registered: Dec 2010
Location: Ahmedabad
Distribution: Red Hat Enterprise Linux and Fedora
Posts: 44

Rep: Reputation: 8
Try by redirecting std error output to /dev/null

Hello,

This is obvious thing that you are asking, while daemon is running then you are trying to execute this command then you'll see that kind of errors and its a obvious behaviour.

As per your questing, I feel that you don't want to see errors you only want to see success output right ? IF that so try following command :-

find /var/spool/mqueue -group abc -exec rm -rf {} \; 2> /dev/null

If you want to save that error output then you try following :-

find /var/spool/mqueue -group abc -exec rm -rf {} \; 2> error-output.txt

Hope this helps you.
 
1 members found this post helpful.
  


Reply

Tags
file not found, find, linux command


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
find command return true if a file was found catalint Programming 12 05-19-2011 07:52 AM
Find command with standard error output and mail error file montblanc Programming 2 11-11-2010 10:06 PM
readprofile command give error in FC5, kernel 2.6.20 skails22 Linux - Newbie 0 03-03-2007 05:21 PM
copying files and give new unique names to each file by using xargs command gnim66 Programming 6 06-22-2005 09:29 PM
linux command error message bash: /usr/bin/find: No such file or directory sundaram123 Linux - General 8 04-02-2002 08:18 AM


All times are GMT -5. The time now is 01:38 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration