Unix Technical Forum

using the -prune option in find

This is a discussion on using the -prune option in find within the Sun Solaris Administration forums, part of the Solaris Operating System category; --> Hi All, I'm trying to do some arguably simple stuff with 'find', and I'm not getting it. Here's the ...


Go Back   Unix Technical Forum > Unix Operating Systems > Solaris Operating System > Sun Solaris Administration

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-12-2008, 06:17 AM
Brian H
 
Posts: n/a
Default using the -prune option in find

Hi All,

I'm trying to do some arguably simple stuff with 'find', and I'm not
getting it. Here's the deal:

I have a sybase server with a filesystem (for the dumps) mounted under
/dump. I also have a cron job that goes through and prunes old files
daily:

find /dump -name "*dump*" -mtime +5 -exec /bin/rm -f {} \;

(My database backups are a bunch of files variously named
DBNAME_dump_yymmddhhss_etc.) That works basically fine. The problem
is I always have the following dumped to standard error:

/usr/bin/find: cannot read dir /dump/lost+found: Permission denied

I'd like to be able to exclude lost+found since it's not permissioned
for sybase, and there's nothing there to prune anyway. Since I get
this error, the operation returns a failed error, and when I
subsequently try to schedule this job in autosys, it always claims the
job failed ... but of course it worked. Simultaneously, I would like
to know if something important failed! But my ham-fisted attempts
with combinations of find, the -prune flag, and (expr) -a (expr) -a
!(expr) (etc) have all failed. Seems like a simple thing to do, but
how?


Thanks,

Brian
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-12-2008, 06:17 AM
Barry Margolin
 
Posts: n/a
Default Re: using the -prune option in find

In article <38582327.0402042026.6313e85f@posting.google.com >,
holy_tire_iron@yahoo.com (Brian H) wrote:

> Hi All,
>
> I'm trying to do some arguably simple stuff with 'find', and I'm not
> getting it. Here's the deal:
>
> I have a sybase server with a filesystem (for the dumps) mounted under
> /dump. I also have a cron job that goes through and prunes old files
> daily:
>
> find /dump -name "*dump*" -mtime +5 -exec /bin/rm -f {} \;
>
> (My database backups are a bunch of files variously named
> DBNAME_dump_yymmddhhss_etc.) That works basically fine. The problem
> is I always have the following dumped to standard error:
>
> /usr/bin/find: cannot read dir /dump/lost+found: Permission denied
>
> I'd like to be able to exclude lost+found since it's not permissioned
> for sybase, and there's nothing there to prune anyway. Since I get
> this error, the operation returns a failed error, and when I
> subsequently try to schedule this job in autosys, it always claims the
> job failed ... but of course it worked. Simultaneously, I would like
> to know if something important failed! But my ham-fisted attempts
> with combinations of find, the -prune flag, and (expr) -a (expr) -a
> !(expr) (etc) have all failed. Seems like a simple thing to do, but
> how?


find /dump -name lost+found -prune -o -name "*dump*" -mtime +5 -exec
/bin/rm -f {} \;

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-12-2008, 06:18 AM
Brian H
 
Posts: n/a
Default Re: using the -prune option in find

Barry Margolin <barmar@alum.mit.edu> wrote:

> find /dump -name lost+found -prune -o -name "*dump*" -mtime +5 -exec
> /bin/rm -f {} \;


I think I found the problem ... this didn't work on the particular box
I was trying it on, which was running a fairly old Solaris 2.6...I
tried it on Solaris 8 and it worked! D'oh!!!

Thanks for the help!


Brian
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-12-2008, 06:18 AM
Barry Margolin
 
Posts: n/a
Default Re: using the -prune option in find

In article <38582327.0402051815.dbf12a9@posting.google.com> ,
holy_tire_iron@yahoo.com (Brian H) wrote:

> Barry Margolin <barmar@alum.mit.edu> wrote:
>
> > find /dump -name lost+found -prune -o -name "*dump*" -mtime +5 -exec
> > /bin/rm -f {} \;

>
> I think I found the problem ... this didn't work on the particular box
> I was trying it on, which was running a fairly old Solaris 2.6...I
> tried it on Solaris 8 and it worked! D'oh!!!


I'm very surprised at that. I'd expect this command to have worked 15
years ago in SunOS 4.0.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-12-2008, 06:21 AM
Brian H
 
Posts: n/a
Default Re: using the -prune option in find

Barry Margolin <barmar@alum.mit.edu> wrote in message news:<barmar-8879A0.21560905022004@netnews.comcast.net>...

> > > find /dump -name lost+found -prune -o -name "*dump*" -mtime +5 -exec
> > > /bin/rm -f {} \;


To which I responded, in part:

> > I think I found the problem ... this didn't work on the particular box
> > I was trying it on, which was running a fairly old Solaris 2.6...I
> > tried it on Solaris 8 and it worked!

>
> I'm very surprised at that. I'd expect this command to have worked 15
> years ago in SunOS 4.0.


All the manuals suggest it should work, but I'm still having problems
with it ... it works some places and not others! On one Sol8 box I've
got this happening:

my_sol8box% find /dump_dir -name lost+found -prune -o -name
"*dump*" -mtime +5
/dump_dir
find: cannot read dir /dump_dir/lost+found: Permission denied


Must be pilot error, but I sure can't figure out why...


Brian
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-12-2008, 06:21 AM
Neil Hoggarth
 
Posts: n/a
Default Re: using the -prune option in find

In article <38582327.0402172014.961be07@posting.google.com> ,
Brian H <holy_tire_iron@yahoo.com> wrote:

> All the manuals suggest it should work, but I'm still having problems
> with it ... it works some places and not others! ...
> Must be pilot error, but I sure can't figure out why...


Is there some shell alias for "find" on some boxes but not others,
perhaps, or a "find" program other than the one in /usr/bin?

Regards,
--
Neil Hoggarth Departmental Computing Manager
<neil.hoggarth@physiol.ox.ac.uk> Laboratory of Physiology
http://www.physiol.ox.ac.uk/~njh/ University of Oxford, UK
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:16 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com