Ensure FTP is complete before using file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Ensure FTP is complete before using file
# 1  
Old 09-07-2004
Ensure FTP is complete before using file

Hi,
I have a program that checks a directory for new files. A file may be placed in the directory only via FTP from another system.

The files are long, the FTP can take several minutes to complete.

my program sences that a file has arrived but can't tell if the FTP process that sent it is complete or not.

In other words, my program can't tell if the file is being written to or not.

Is there a UNIX command that I can use either in ksh or C that would tell me if a file is being used by another process?


Thanks.
ekareem
# 2  
Old 09-07-2004
You could get a copy of lsof
# 3  
Old 09-07-2004
This is cool
Thanks
# 4  
Old 09-07-2004
Quote:
my program sences that a file has arrived but can't tell if the FTP process that sent it is complete or not.
Why not have the program look for a `trip-file` which would be created on completion of the FTP step.
# 5  
Old 09-08-2004
OK, this sounds good - What is a 'trip-file'? Is it a file sent from source indicating the completion of FTP?
# 6  
Old 09-08-2004
Quote:
OK, this sounds good - What is a 'trip-file'? Is it a file sent from source indicating the completion of FTP?
A trip-file is a file that you would generate after the FTP process has completed.

Hence, your program would look for the trip-file instead.
This would indicate that the FTP process has completed and the file/s are ready to access.

EG:
> Youg Program to look for trip-file `proc-a-ftpcomp` ...

* Start of proc-a-ftp * (Process `A` FTP)
> FTP process begins first file ...
> FTP process begins subsequent files ...
> FTP process completes and terminates FTP ...

* Creation of Trip-File *
Trip-File (`proc-a-ftpcomp`) created if the FTP process completes without error.
It does not need to contain data (unless you see a need to).

* Keep going *
Your Program then see's the existance of the trip-file and continues processing.

HTH's
# 7  
Old 09-08-2004
This is a very good idea. Thanks.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to ensure a script can only be invoked from another?

Hi All, I have two scripts - ScriptA and ScriptB ScriptA has logic to invoke ScriptB : - with some parameter - or without any parameter ScriptB can also be invoked by the user from the command line. Is there anyway to ensure that when I execute ScriptB from the command line, it does... (3 Replies)
Discussion started by: chaitanya.gvc
3 Replies

2. Programming

Ensure C++ will work on a Unix system

For my one college course, my professor said that we have to ensure that the C++ code we send him will work on a Unix system. I in turn installed Cygwin on my Windows 7 machine, and have been using that to compile and check my code, but it sounds like Cygwin is still compiling the code for my... (2 Replies)
Discussion started by: davidp007
2 Replies

3. Shell Programming and Scripting

Ensure file copy is complete before starting process

Hi experts, I have a requirement wherein a user is uploading a file to the Landing directory on one of our Linux servers. A cron job is scheduled to run after every 5 minutes which will pick up the files from the source (Landing) dir and copy to the target dir, and once successfully copied to... (4 Replies)
Discussion started by: adi_2_chaos
4 Replies

4. AIX

How to ensure mksysb backup completed successfully.

Hi All, I want to know, how we can ensure that mksysb backup completed successfully and is restorable. I know one way my command lsmksysb -B but I found that one mksysb who has not backedup all the files was also showing in this command output, so that doesn't ensure its integrity and... (1 Reply)
Discussion started by: falgun6666
1 Replies

5. Shell Programming and Scripting

Checking for FTP complete

Hi, I have a situation where I'm downloading multiple files from a remote system and I need to start a process after all the files are downloaded completely. How can I achieve it. Eg. I have 6 files, file1, file2, file3.... file6. I need to start a script scrpt1 after all the files have... (4 Replies)
Discussion started by: bornon2303
4 Replies

6. IP Networking

A test to ensure TCP/IP configuration is complete

Greetings. I have Debian lenny, and at the moment only the bare bones install, no GUI. I'm connecting via wireless to a Linksys router on a home network, and I manually configured a fixed ip etc during the install. I have not attempted to use any higher level apps such as ftp or telnet or apt yet.... (3 Replies)
Discussion started by: fguy
3 Replies

7. UNIX for Dummies Questions & Answers

BASH complete-filename & menu-complete together

Hi, Does anyone know how to make BASH provide a list of possible completions on the first tab, and then start cycling through the possibilites on the next tab? Right now this is what I have in my .bashrc: bind "set show-all-if-ambiguous on" bind \\C-o:menu-complete This allows... (0 Replies)
Discussion started by: Mithu
0 Replies

8. Shell Programming and Scripting

script to ensure lines are in sequence

Hello there, I check files containing more than 2000 lines, I try to make sure that the lines are in sequence...for example the first line begins with Av567, second line contains Av568 and so on up to the last line that may contain Av2500. I need a script to check that all lines are in sequence... (5 Replies)
Discussion started by: docaia
5 Replies

9. Shell Programming and Scripting

Ensure the file completion ?

Hi, I would like to copy a file from one location to another. But that particular file is not fully loaded. I like to copy a file once it's fully loaded or complete file. How to ensure whether file is fully loaded or complete file?. -Thambi (5 Replies)
Discussion started by: thambi
5 Replies
Login or Register to Ask a Question