home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7366 < prev    next >
Encoding:
Text File  |  1992-12-11  |  2.0 KB  |  47 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!panther!mothost!merlin.dev.cdx.mot.com!fendahl.dev.cdx.mot.com!mcook
  3. From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
  4. Subject: Re: Testing if a file is closed?
  5. Message-ID: <mcook.724094539@fendahl.dev.cdx.mot.com>
  6. Sender: news@merlin.dev.cdx.mot.com (USENET News System)
  7. Nntp-Posting-Host: fendahl.dev.cdx.mot.com
  8. Organization: Motorola Codex, Canton, Massachusetts
  9. References: <GLEWIS.92Dec9114722@fws204.intel.com> <mcook.724004050@fendahl.dev.cdx.mot.com> <1992Dec11.111959.27875@cs.ruu.nl>
  10. Distribution: comp
  11. Date: Fri, 11 Dec 1992 17:22:19 GMT
  12. Lines: 33
  13.  
  14. piet@cs.ruu.nl (Piet van Oostrum) writes:
  15.  
  16. >>>>>> mcook@fendahl.dev.cdx.mot.com (Michael Cook) (MC) writes:
  17.  
  18. >MC> glewis@pcocd2.intel.com (Glenn M. Lewis - ICD ~) writes:
  19.  
  20. >>    I'm afraid I can't figure out from the book or reference guide
  21. >>how to test whether or not a file is closed.  Sorry if this is a silly
  22. >>question.
  23.  
  24. >>    Here is my situation...  Some other machine is writing into a
  25. >>directory that my Perl script is scanning for files.  My script needs
  26. >>to know when the other machine has closed the file after it finishes
  27. >>writing to it.  I have zero control over the other machine, so I can't
  28. >>make it create any other synchronizing files, such as "file.lock" and
  29. >>then removing it when finished.  I must determine in my script when
  30. >>the file in question is complete and closed to writing.  Is this
  31. >>possible from Perl?
  32.  
  33. >MC> Whether it is possible is dependent on your operating system.  In
  34. >MC> general, I don't think Unixes will let you know whether some other
  35. >MC> process has a file open.
  36.  
  37. >The way this should be done is that the PRODUCERS of the files should
  38. >create a temp file first, on the same disk partition, and when the file is
  39. >complete and closed, rename it so that the spooler will recognize it.
  40.  
  41. Yes, that's a reasonable solution ...except that Glenn originally said this:
  42.  
  43. >>I have zero control over the other machine, so I can't make it create any
  44. >>other synchronizing files,
  45.  
  46. Michael.
  47.