- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Check if a given file is open by another proce...
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
тАО08-31-2010 02:53 AM
тАО08-31-2010 02:53 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2010 02:59 AM
тАО08-31-2010 02:59 AM
SolutionOPEN/READ/WRITE would fail if the file was open by another process.
Or look for the file name in SHOW DEVICE/FILES
Purely Personal Opinion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2010 03:05 AM
тАО08-31-2010 03:05 AM
Re: Check if a given file is open by another process
With
$ SHOW DEVICE/FILES disk:
You can find open Files on this Disk.
You could also do something like this:
$ PIPE SHOW DEVICE/FILES disk: | SEARCH SYS$PIPE file-of-interest
$ sts = $STATUS
The variable sts contains the status of Search. If this status is %X10000001 the File was found and is open.
Hope that helps
Regards
Geni
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2010 03:08 AM
тАО08-31-2010 03:08 AM
Re: Check if a given file is open by another process
$ show dev /files
will only tell you if it is open on the current node.
Dave.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2010 03:53 AM
тАО08-31-2010 03:53 AM
Re: Check if a given file is open by another process
What happens if an attempt is made to open a fiel while you have, presumably, have it locked due to the compress?
Personaly, I'd be looking at a defined downtime window in order for this sort of housekeeping to take place.
HTH
Craig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2010 04:15 AM
тАО08-31-2010 04:15 AM
Re: Check if a given file is open by another process
a) I was using already the show devices, but the disks contain many many files, in a cluster environment with many users, and I manage thousands of those files, so it is not very efficient.
b) Compressing a file entails reading it in memory and creating a new, compressed version, and then I purge the old one. The access to the files is shared, so while an user writes, others may read. If a user has the file open to write some data, I read it and create the new version, the user closes the file, and I delete the old version, the user's results are lost. It has happened.
c) The solution is the OPEN/READ/WRITE, and check the $STATUS
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2010 04:16 AM
тАО08-31-2010 04:16 AM
Re: Check if a given file is open by another process
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2010 04:20 AM
тАО08-31-2010 04:20 AM
Re: Check if a given file is open by another process
This is a more coordinated way and will prevent any applications from getting open errors etc.
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2010 01:44 PM
тАО08-31-2010 01:44 PM
Re: Check if a given file is open by another process
A general principle for this type of question, which comes down to...
"if I do
with a view to implementing
"1) test if
2) if ok do
3) if not ok handle error
The problem with this concept is you're trying to predict the future, whether it be files being locked, sufficient disk space, or presence or absence of some condition. Whatever, there is a time window between steps 1 and 2. That means if you get an OK at step 1, it can have changed by the time you start step 2. Similarly, a failure at step 1 may have come good by the time you do step 3. No matter what, you have the possibility of false positives and negatives, so will still need to handle failure at step 2.
Thus, it's usually better to not even attempt to predict anything, just charge ahead and try the action. Deal with failure if it happens:
1) do
2) if failure, handle it
Sometimes the objective is to not generate unnecessary error messages. If that's the case, a fairly general DCL construct is:
$ PIPE some-command >NL: 2>NL:
$ stat=$STATUS
$ IF .NOT.stat THEN handle error
Since it's a single stage pipe, it executes in the context of the current process (so it doesn't cost you a process creation), both SYS$OUTPUT and SYS$ERROR are sent to NL:, and you get $STATUS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2010 01:13 AM
тАО09-01-2010 01:13 AM
Re: Check if a given file is open by another process
What you propose is a nice and general way to do things. In my case I am going to wear belt and suspenders:
1) Check whether file is unaccessed (with OPEN/READ/WRITE). If so, record the time/date of last modification, and go to 2); else, process the next file.
2) Read the file, compress it, and create a new version. If no error go to 3); else delete the new version and process the next file.
3) Check the modification date of the old version. If unchanged, delete it. If changed, delete the new version and process the next file.
This procedure is run periodically, and it is a not a big deal to skip some files: they'll be processed the next time.