- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Identify files in use (lsof or another method)
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
Forums
Discussions
Discussions
Discussions
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
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-09-2006 08:48 AM
04-09-2006 08:48 AM
Identify files in use (lsof or another method)
It's plain using the following:
/usr/local/bin/lsof
The files to be identified have the following criteria:
1) Each time the files in question are to be checked if they are being used at a particular time, they are all being checked in a particular location. Example:
Files to be checked if they are in use are located in /home/user1/ or /home/user2 or /home/user3 (the script is checking each location to do some archiving for files that meet certain criteria).
2) Currently, the lsof is being used which causes a very lenghty search, each time it runs it runs over 1 min. per iteration, causing huge delays and amounts of CPU usage... We are not interested in checking ports names, other users, etc... Just the files currently in use and owned by the particular user in question.
Andy ideas of any other method, lsof would be fine if it did not take such a long time 1-2 min.
MAD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2006 09:01 AM
04-09-2006 09:01 AM
Re: Identify files in use (lsof or another method)
In lieu of 'lsof' you can use 'fuser' to determine what (if any) processes are using a file and how:
http://www.docs.hp.com/en/B2355-60127/fuser.1M.html
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2006 02:15 PM
04-09-2006 02:15 PM
Re: Identify files in use (lsof or another method)
Well then you can slim-down the lsof command by removing the unwanted stuff from it and focussing only on what is desired. This will certainly reduce the running time of lsof
cheers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2006 07:11 PM
04-09-2006 07:11 PM
Re: Identify files in use (lsof or another method)
if the number of files in /home/userx is not too important, runnning a command such as
find /home/userx -exec fuser {} \;
or
lsof /home/userx -exec lsof {} \;
may reduce the time needed to check files.
What about using repeated mode of lsof (lsof -r ): does it bring some improvement in your situation ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2006 12:20 PM
04-10-2006 12:20 PM
Re: Identify files in use (lsof or another method)
James, one of my colleagues had already mentioned the possible solution you mentioned, fuser... However, this would require extensive rewriting of the script, and I would rather find a way to keep usage of lsof if possible.
Recently I tried some tests with the '-u' option (lsof -u
Antonio, I have to look into your suggestion, I'll assign points later. And Sandman, any examples (I am only intersted in files being used and nothing else-- no ports, etc)?
Thanks again everyone, I hope to be able to close this thread as soon as I have a feasible solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2006 12:30 PM
04-10-2006 12:30 PM