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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| 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 *** |
| |||
| 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 |
| |||
| 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 *** |
| |||
| 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 |
| ||||
| 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 |