- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- "find -exec rm" command inconsistent response
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2006 04:42 AM
тАО04-28-2006 04:42 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2006 04:47 AM
тАО04-28-2006 04:47 AM
Re: "find -exec rm" command inconsistent response
Define "similar" -- what release? What response that you expect aren't you getting?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2006 04:55 AM
тАО04-28-2006 04:55 AM
Re: "find -exec rm" command inconsistent response
While the "\+" is more effiecient than "\;", at least initially, I would replace it with "\;" and see if that improves the "no response" condition. I also suggest that you replace the "-exec rm {} \+" with something like "-exec ls -ls {} \;" so that it is very clear what arguments are supplied. Because you don't bother to identify your version of HP-UX, it's possible that you are running an old version with a smaller ARGMAX value so that the actual problem is that you are overflowing the argument list with your use of "\+". In any event, the more robust approach is to use the xargs command instead to aggregate the argument. You then have a controlled manner in which to group multiple arguments that prevents overflow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2006 05:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2006 05:43 AM
тАО04-28-2006 05:43 AM
Re: "find -exec rm" command inconsistent response
on the sixth machine your rm command finds a directory, /vz/data/prod/pipe_work, which it cannot delete, therefore the message.
On the other five machine the rm command did not encounter any directories.
Go and check that /vz/data/prod/pipe_work is in fact a directory on machine no. six and try also to create a directory under /vz/data/prod on any of the other machines: you should then get the same response - after 24 hours.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2006 05:56 AM
тАО04-28-2006 05:56 AM
Re: "find -exec rm" command inconsistent response
The 6 HP9000s are all HP-UX 11.11, with identical filesystems. The dir /vz/data/prod/pipe_work is a tmp dir for our application. The "-mtime +1 -exec rm" is intended to remove files over a day old. On 5 of the 6 systems, issuing the command " find /vz/data/prod/pipe_work -mtime +1 -exec rm {} \+ " results in a returned command prompt, i.e. no complaining from the OS. On the 6th system, the OS complains " rm: /vz/data/prod/pipe_work directory " - whether there are files to be removed or not. Dir /vz/data/prod/pipe_work exists and contains files on all 6 systems. Victor, the find -type suppresses the rm message, thanks. Still looking for the cause though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2006 06:11 AM
тАО04-28-2006 06:11 AM
Re: "find -exec rm" command inconsistent response
The error is acutally self-explanatory.
"rm: /vz/data/prod/pipe_work directory"
...simply says that '/vz/data/prod/pip_work' is a *directory* and hence cannot be removed by 'rm'.
On the server wiht the "problem", an 'ls -ld /vz/data/prod/pipe_work' should show a directory that is older than 24-hours. On the servers that don't "complain" that directory should be *younger* than 24-hours old in terms of its last modification timestamp. Hence, on those servers, no attempt is being made to remove it.
Your 'find' command should look like:
# find /vz/data/prod/pipe_work -type f -mtime +1 -exec rm {} \+
...to limit the 'rm' to files and not files and directories. If you truly want to remove both files and directories, do:
# find /vz/data/prod/pipe_work -mtime +1 -exec rm -r {} \+
For better (much better) performance, use 'xargs' in lieu of '-exec', thusly:
# find /vz/data/prod/pipe_work -type f - time +1 | xargs rm
...This will collect groups of filenames as multiple arguments to 'rm' thereby spawning one process to remove many files at once instead of spawning one process to remove one file at a time --- a very expensive thing to do!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2006 06:41 AM
тАО04-28-2006 06:41 AM
Re: "find -exec rm" command inconsistent response
Your explanation of why the 6 systems are behaving differently is spot-on, as is your discussion of using xargs vs "\;" in a find command. But the usage Lonny is using with his find command is "\+" which behaves similarly to xargs, executing one command-line with all the "found" files as parameters. So xargs is the more common method to do this, but will not perform significantly differently than "find ... -exec rm {} \+"
--Greg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2006 06:50 AM
тАО04-28-2006 06:50 AM
Re: "find -exec rm" command inconsistent response
Good point! You are of course correct. The plus sign in lieu of '\;' vastly improves performance by bundling multiple arguments. From habit, I use 'xargs' and tend to forget about the newer approach. Thanks for pointing that out.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2006 06:56 AM
тАО04-28-2006 06:56 AM