![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Download HP-UX | prashantbhushan | HP-UX | 1 | 03-06-2008 03:51 AM |
| How to direct a script to a new web page after a script got completed? | rajbal | Shell Programming and Scripting | 2 | 05-22-2007 09:32 AM |
| download | kabouter5454 | UNIX for Dummies Questions & Answers | 1 | 12-20-2005 02:39 PM |
| killing a unix job after the job process gets completed | dtazv | SUN Solaris | 7 | 09-28-2005 04:18 AM |
| Retrieving the execution time of a completed command | marina | UNIX for Dummies Questions & Answers | 2 | 09-06-2005 01:21 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
When a FTP download is completed
I receive files by FTP in an input directory. Every 10 seconds a process checks if some new file has arrived to the input directory and then the process moves them to another directory to be read by a second process.
The problem is that there is no way to know if the download has finished or not. Sometimes my process moves the file when I have received only a part of it. Is there any way to know if the FTP download is completed ? I have tested the file with 'lsof', 'stat', ... but it doesn't work. The same process works fine in AIX. If I try to open a file that is downloading at the same time, I receive an error 'Resource is busy'. I use this error to check if the download is completed. But in Linux ( SuSe ) I don't receive any error. Thanks |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
while I believe there's no "bullet-proof" solution to this.... you can try using 'fuser' [or lsof if you have one] to see if a file is being used by someone else.
Worth looking into at least..... |
|
#3
|
||||
|
||||
|
try checking for the ftp connection ...
Code:
#! /bin/ksh
ftpOn=$(netstat -a | awk '/ESTABLISHED/ && /ftp/ {print $2}')
if [ ! $ftpOn ]
then
echo "ok to proceed"
fi
exit 0
Last edited by Just Ice; 06-15-2005 at 09:20 AM. |
|
#4
|
||||
|
||||
|
there might be multiple unrelated ftp sessions
|
|
#5
|
||||
|
||||
|
true ... it might be better to combine the netstat-ftp check with fuser so there is some sort of confirmation that the file is indeed being written to ...
|
|
#6
|
|||
|
|||
|
Also, it might be possible to ask the ftp transmitter to send another file when the first ftp is complete. It would be a 0 byte or small file and then you would just check for the existense of that file.
|
|
#7
|
||||
|
||||
|
that might sound like the easiest option but that would mean 2 scripts have to be modified ... considering that the same script works well in another platform --- i would opt to just modify 1 script myself as that would keep the appearance of new "features" to a minimum ...
|
||||
| Google The UNIX and Linux Forums |