Files opened by other processes [message #30923] |
Tue, 28 May 2002 17:22  |
Daniel Peduzzi
Messages: 29 Registered: June 1999
|
Junior Member |
|
|
Has anybody been able to use IDL to detect if *other* processes
have a particular file open?
As an example, let's say I would like to open a file for read access
after it has been written by an FTP process. I certainly don't
want to open it until the file transfer is complete...but how will I
know?
I looked at the FSTAT function, but unless I've overlooked
something, I don't think it will suffice. This is on a UNIX system
running SunOS, so if I have to write something in C for IDL to
spawn, I guess I'll be posting to another newsgroup soon. ;- )
Dan
Daniel C. Peduzzi
peduzzi@attbi.com
|
|
|
Re: Files opened by other processes [message #31005 is a reply to message #30923] |
Wed, 29 May 2002 09:15  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Nigel Wade wrote:
>
> Daniel Peduzzi wrote:
>
>> Has anybody been able to use IDL to detect if *other* processes
>> have a particular file open?
>>
>> As an example, let's say I would like to open a file for read access
>> after it has been written by an FTP process. I certainly don't
>> want to open it until the file transfer is complete...but how will I
>> know?
>>
>> I looked at the FSTAT function, but unless I've overlooked
>> something, I don't think it will suffice. This is on a UNIX system
>> running SunOS, so if I have to write something in C for IDL to
>> spawn, I guess I'll be posting to another newsgroup soon. ;- )
>>
>> Dan
>>
>> Daniel C. Peduzzi
>> peduzzi@attbi.com
>
> The simple answer is that it's very complicated. There are no really good
> ways to determine when a file transfer is complete. Just checking for the
> file being open (if you can do this) won't tell you if the file transfer
> didn't complete - the file will still be closed, but incomplete.
>
> It's quite a common problem to want to be able to process files after they
> have been transferred by FTP, but I've not yet found a good, general,
> solution. Two possibilities spring to mind:
>
> a) transfer the file under a temporary name, and then get the sender to
> rename it when the transfer completes.
My linux transfers files with extension .part and if it's ready then the
file
is renamed.
This could be a feature of the package wu-ftp. May be this is available
for you too.
> b) prior to sending the file, send a temporary file with a byte count and
> checksum for the file. Don't use the file until the byte count and checksum
> for it agree with those sent.
>
> --
> -----------------------------------------------------------
> Nigel Wade, System Administrator, Space Plasma Physics Group,
> University of Leicester, Leicester, LE1 7RH, UK
> E-mail : nmw@ion.le.ac.uk
> Phone : +44 (0)116 2523568, Fax : +44 (0)116 2523555
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
============================================================ =======
|
|
|
Re: Files opened by other processes [message #31020 is a reply to message #30923] |
Wed, 29 May 2002 01:38  |
Nigel Wade
Messages: 286 Registered: March 1998
|
Senior Member |
|
|
Daniel Peduzzi wrote:
> Has anybody been able to use IDL to detect if *other* processes
> have a particular file open?
>
> As an example, let's say I would like to open a file for read access
> after it has been written by an FTP process. I certainly don't
> want to open it until the file transfer is complete...but how will I
> know?
>
> I looked at the FSTAT function, but unless I've overlooked
> something, I don't think it will suffice. This is on a UNIX system
> running SunOS, so if I have to write something in C for IDL to
> spawn, I guess I'll be posting to another newsgroup soon. ;- )
>
> Dan
>
> Daniel C. Peduzzi
> peduzzi@attbi.com
The simple answer is that it's very complicated. There are no really good
ways to determine when a file transfer is complete. Just checking for the
file being open (if you can do this) won't tell you if the file transfer
didn't complete - the file will still be closed, but incomplete.
It's quite a common problem to want to be able to process files after they
have been transferred by FTP, but I've not yet found a good, general,
solution. Two possibilities spring to mind:
a) transfer the file under a temporary name, and then get the sender to
rename it when the transfer completes.
b) prior to sending the file, send a temporary file with a byte count and
checksum for the file. Don't use the file until the byte count and checksum
for it agree with those sent.
--
-----------------------------------------------------------
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523568, Fax : +44 (0)116 2523555
|
|
|