ftp process end problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ftp process end problem
# 1  
Old 05-06-2010
ftp process end problem

my server gets text based files by ftp and one of my scripts opens and parses it.
but sometimes my script opens the file for parsing before the ftp ends. so while the file growing it parses it and moves to another location. because of this i usually get "end of file " error while opening files.

how can i determine whether file is ended and ftp process that writes to it finished.
# 2  
Old 05-06-2010
you can try using fuser command
Code:
COUNT=`fuser /path/to/file | wc -c`
if [ $COUNT -gt 0 ]
   then echo file is open
fi

# 3  
Old 05-06-2010
If you have control of the sending location, you can also have it send a second file of nominal size, and only process files for which the second file exists. This will also cover the possibility of the file not being in use because the ftp process died.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Need to end Backup Process SCO Openserver 5

I was attempting to run a backup at our business last Friday evening when I apparently locked up our whole mainframe. Rather than observing the current time and adding a minute or two to that for the backup start time (like I typically would), I accidentally entered the actual current time to the... (11 Replies)
Discussion started by: hometrics
11 Replies

2. UNIX for Advanced & Expert Users

Empty lines at the end of the payload generated in FTP server

Hi All, I am facing an issue in one of the use cases that I am trying to implement. I am getting a purchase order from one of the trading partners through Oracle B2B. B2B forwards this B2BM (B2B message ) to AIAB2BInterface. From AIAB2BInterface my BPEL process gets invoked, which in turn... (1 Reply)
Discussion started by: mayank2211
1 Replies

3. Shell Programming and Scripting

Scripting with FTP Process

Hi Guys, Good day ULF! I have a general "auto-ftp" code which looks something like this: #!/bin/sh cd $1 ftp -v -n $2 << EOF user $3 $4 prompt cd $5 bin mput $6 quit EOF This works pretty well, but I'm thinking of how can I make a code by maybe including on this code, for... (5 Replies)
Discussion started by: rymnd_12345
5 Replies

4. UNIX for Advanced & Expert Users

ftp - any best practices for signalling end of transfer?

Hi, I'm writing shell scripts to handle incoming and outgoing automated sftp transfers between a local server and various remote servers belonging to different organizations. I'm wondering if there are any recommended or "best practices" for signalling the end of a ftp file transmission... (2 Replies)
Discussion started by: _dev_null
2 Replies

5. Shell Programming and Scripting

How to put FTP process as a background process/job in perl?

Hi, I am using net::ftp for transferring files now i am trying in the same Linux server as a result ftp is very fast but if the server is other location (remote) then the file transferred will be time consuming. So i want try putting FTP part as a background process. I am unaware how to do... (5 Replies)
Discussion started by: vanitham
5 Replies

6. Shell Programming and Scripting

end of file error bash ftp script

Hello kind programmers :) I am a newbie and running into an error "line 28: syntax error: unexpected end of file" on the script shown below. Any help would be greatly appreciated. Thanks! #! /bin/bash if ($#argv <3) then echo 'Usage get_modis_snow ' echo 'ftp script for MYD10A2... (2 Replies)
Discussion started by: cmshreve
2 Replies

7. Shell Programming and Scripting

Need to echo a text where a (.) is added to the end of line during on-going copy or ftp

Hello All, I would like to create a script to echo a text where a (.) dot is added every 2 seconds to the end of this text (with a limit of 10 dots) as long as a file copy or ftp is ongoing and once the copy is finished it adds "done" to the end of this text line. please see the below example: ... (6 Replies)
Discussion started by: Dendany83
6 Replies

8. UNIX for Dummies Questions & Answers

Shell Script to end process help

I'm trying to write shell script that when invoke, has 2 arguements, or 1. If there's one arguement, then that's the process name. If there's 2, then one is the timeout. USAGE: Assign1.sh <process> <timeout> If no timeout was set, then the default timeout is 15 minutes. So after it read the... (6 Replies)
Discussion started by: NoobieBoobie
6 Replies

9. Shell Programming and Scripting

How to know Any Process End Time?

Hi All, I want to know process end time. ps -eaf | grep java.exe It will give the user, PID, PPID,Process start time,TTY,CMD ... How to know the Process End Time. Suppose the Java Process will be start @ APR 07. The Process may be STOP @ APR 08 How to know PROCESS End... (2 Replies)
Discussion started by: hanu_oracle
2 Replies

10. UNIX for Dummies Questions & Answers

Monitoring ftp process

I have an ftp process using vpn, my box is receiving data hit and miss from the host system. Any tool that can be used within unix (ksh) to monitor that ftp process? (2 Replies)
Discussion started by: arkhewit
2 Replies
Login or Register to Ask a Question