LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   find command give error file not found (https://www.linuxquestions.org/questions/linux-newbie-8/find-command-give-error-file-not-found-882968/)

vishesh 05-27-2011 01:09 AM

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 ..

EricTRA 05-27-2011 01:41 AM

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

EricTRA 05-27-2011 01:43 AM

Hello,

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

Kind regards,

Eric

vishesh 05-28-2011 05:37 AM

My question is not sendmail related . I know how to clean sendmail queue . I question is related to find command

Thanks

EricTRA 05-28-2011 06:27 AM

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

networking.dept 05-28-2011 08:17 AM

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.


All times are GMT -5. The time now is 12:05 AM.