Unix Programming - File open?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > November 2005 > File open?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author File open?
John Estess

2005-11-09, 5:53 pm

Is there a standard way to determine if any given file is opened for
reading or writing (or both)? I would like to ftp a file after I
determine that the file is no longer being written to by a daemon
process I have no control over. Is that possible? Thank you.

jhestess@yahoo.com
Fletcher Glenn

2005-11-09, 5:53 pm

John Estess wrote:
> Is there a standard way to determine if any given file is opened for
> reading or writing (or both)? I would like to ftp a file after I
> determine that the file is no longer being written to by a daemon
> process I have no control over. Is that possible? Thank you.
>
> jhestess@yahoo.com


If you're writing a script, you might look at the fuser command.

--

Fletcher Glenn

SM Ryan

2005-11-09, 5:53 pm

John Estess <jestess@elp.rr.com> wrote:
# Is there a standard way to determine if any given file is opened for
# reading or writing (or both)? I would like to ftp a file after I
# determine that the file is no longer being written to by a daemon
# process I have no control over. Is that possible? Thank you.

A portable way is to stat the file periodically and wait until
the mtime, size, and dev:ino do not change for some interval.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
So....that would make Bethany part black?
Måns Rullgård

2005-11-09, 5:53 pm

Fletcher Glenn <fletcher@removethisfoglight.com> writes:

> John Estess wrote:
>
> If you're writing a script, you might look at the fuser command.


Anything can happen between the time you check it and the time you
start doing things based on the check.

--
Måns Rullgård
mru@inprovide.com
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com