The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 06-26-2006
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
For socket introduction, see

http://perldoc.perl.org/perlipc.html...-Communication

As for checking whether the file is being held open, I think you can't get this information. You can just assume that when, e.g. copy or move returns, that file has been moved. But you know the OS may return before this is physically completed and give you a view that the file has been relocated, but the writing is still going on (due to DMA, maybe). flocks won't work either because of its discretionary nature.

The typical way is to write some dummy, hidden file to indicate the status beforehand, just as vim does. The file is cleaned when the operation completes. That's why shell scripts are usually full of this kind of tricks.