[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

7452.0. "How do you know if the file is opened in Unix" by TELEM::VIJAY () Mon Oct 14 1996 14:09

T.RTitleUserPersonal
Name
DateLines
7452.1That depends on what you mean by "file"...WTFN::SCALESDespair is appropriate and inevitable.Mon Oct 14 1996 15:3711
7452.2Simple fstat() exampleDECC::SULLIVANJeff SullivanMon Oct 14 1996 15:5237
7452.3ThanksTELEM::VIJAYMon Oct 14 1996 16:481
7452.4VAXCPU::michaudJeff Michaud - ObjectBrokerFri Dec 27 1996 19:303
7452.5Does someone have /a/b/c/d open for writeCXXC::REINIGThis too shall changeTue Apr 01 1997 20:245
Is there someway to find out if another process has a file open for write
given just the pathname for the file?  I control the other process so if it
requires that the other process do something special, that's fine. 

                                August G. Reinig
7452.6KITCHE::schottEric R. Schott USG Product ManagementTue Apr 01 1997 21:045
You might start with file locking in both processes.

If that is not good enough, you may have to go to special lock files
to mark more specific information.

7452.7Try lsof ...NETRIX::"[email protected]"Detlef SchmierWed Apr 02 1997 02:5721
There is also a public domain program called lsof. It shows you every
open file. And you have lots of options.

You can find the latest version in
	ftp://vic.cc.purdue.edu/pub/tools/unix/lsof

Detlef.

========================================================================
Detlef Schmier @RTO                 Digital Equipment GmbH
SBU, OEM/GY                         Freischuetzstrasse 91
Field Application Engineer          D-81927 Muenchen
Pub.Tel. +49-(0)89-9591 2752        DTN 865-2752
Mobile   +49-(0)171-3357582
Fax #    +49-(0)89-9591 1278        DTN 865-1278
========================================================================
eMail    : [email protected]
URL      : http://www.digital.de/infocenter/toem-gy/detlef.html
========================================================================

[Posted by WWW Notes gateway]
7452.8CXXC::REINIGThis too shall changeWed Apr 02 1997 10:235
> You might start with file locking in both processes.
    
    Where do I find out more information?
    
    
7452.9One possible solutionCXXC::REINIGThis too shall changeWed Apr 02 1997 12:5914
I think the following will work.  The first process will open the file for
write.  Every second it will update the access and modification times of
the file using utime.  When the second process believes that the first has
crashed (and no longer has the file open for write),  it will monitor the
file for a few seconds using stat.  If the access and mmodification times
do not change the first process can't have the file open.  If the times do
change the first process does have the file open.

The first process and the second process will be on different machines. 
The file will be common to the two machines through ASE.  How long will it
take for the effects of a call to utime from the first process to be
visible to the second process.  I'm willing to wait quite awhile (minutes).

                                        August
7452.10whoaUSCTR1::ASCHERDave AscherThu Apr 03 1997 16:1013
re:           <<< Note 7452.9 by CXXC::REINIG "This too shall change" >>>
                           -< One possible solution >-
The first process and the second process will be on different machines. 
The file will be common to the two machines through ASE.  How long will it
take for the effects of a call to utime from the first process to be
visible to the second process.  I'm willing to wait quite awhile (minutes).

    Please let me be the first to inform you that files don't get
    to be common through ASE. If you have processes on different
    machines accessing the same file then they had better be using
    NFS for access.
    
    
7452.11DECCXX::REINIGThis too shall changeSun Apr 06 1997 22:4212
    > Please let me be the first to inform you that files don't get
    > to be common through ASE. If you have processes on different
    > machines accessing the same file then they had better be using
    > NFS for access.
    
    While I can use NFS, I thought that the whole point of ASE was to have
    two systems connected to the same SCSI bus looking at the same disks. 
    How can the files not be common?  They are on the disk visible to both
    machines.
    
                                            August
    
7452.12Only VMS does genuine dual-access SCSI clustering?BBPBV1::WALLACEjohn wallace @ bbp. +44 860 675093Mon Apr 07 1997 06:285
    But are both hosts able to see the same disks "at the same time" via
    SCSI ? I thought only VMSclusters gave you that, and ASE and NT
    clusters give you failover between alternate hosts. With ASE and NT you
    have to interpose some kind of file service to make failover more
    transparent. I could be wrong...
7452.13Failover and load balancing, but not OpenVMS shared disksUNIFIX::HARRISJuggling has its ups and downsMon Apr 07 1997 10:0325
    ASE does _NOT_ have OpenVMS Cluster style sharing.  In a stable
    environment only 1 system has control over a subset of the disks.  All
    other systems in the ASE environment use NFS to access that subset of
    disks on the shared SCSI.
    
    The unique feature of ASE is that the an NFS service has its _OWN_ IP
    address, so that you can fail the service over to a different node in
    the ASE system and the NFS users do not know the difference (since NFS
    is stateless).
    
    Multiple NFS services can exist in an ASE system so that you can load
    balance the different systems.
    
    Also ASE provides other services besides NFS which also get their own
    IP addresses so that they to can be failed over (although if the
    connections have any state information, the failover will not be
    transparent).
    
    But ASE is _NOT_ OpenVMS clusters.
    
    I do not know what the future holds for TruClusters.  Maybe they will
    introduce shared disks using the Distributed Lock Manager in a future
    release.
    
    					Bob Harris
7452.14Thanks for the informationCXXC::REINIGThis too shall changeMon Apr 07 1997 10:489
    Oh.  So even though system two has a direct connection to the disk it
    still has to go over the net to system one to get the bits from the disk. 
    The only time system two can access the bits directly is when system
    one has crashed.
    
    Still, I don't see that this affects my proposed algorithm.  There is
    an NFS connection between the two machines. 
    
                                        August