On 6/21/05, Anders Johansson <andjoh@rydsbo.net> wrote:
On Tuesday 21 June 2005 17:21, daniel parkes wrote:
hy people!,
the thing is i have an AIX box that downloads things from a ftp and another program that moves everything that's in the directory to another FS the thing is that in aix if you try to cp a file that is in use it says resource is busy but now im migrating the program to suse linux and i find this problem:
even if the download hasnt finished the cp or mv starts and my file gets copied or moved in a corrupt state, thats why i was looking for a ftp server
You mean client, surely
that blocked the files until the download has finished . and the prob is i cant change the program to put in a scrip it has to stay as it is!.
Why?
Since you are free to choose another ftp client, why not simply make it a simple script like
cd $TMPDIR wget $FILENAME mv $FILENAME $FINAL_DESTINATION_DIR
There is no way to "block" files, the only way I can see would be to play with permissions, but if you're free to pick an ftp client, why not do it the easy way?
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
If I did get you right, I'd see some more ideas to this problem, as it is not really a new one.. mh.. well, I got no ftp-server in mind which takes care about this, but 1. you could play with "flock" if you are on the local filesystem if you cannot open this file with an exclusive lock, you know the file is still opened for writing (this also causes an exclusive lock). very easy that one, but with the limitation that it's only working on local fs ( ok, and shares .. ), which means you would have to write your own ftp-server, or you could find a workaround somehow.. 2. you could simply check the current filesize with your ftp-client script ( dunno, you mentioned it cannot or should not be altered, that's bad.. ) and keep this information. After a period, let's say 10seconds or so you check it again and compare the new filesize with the filesize from the last check. If they are identically, that means the file has not been changed for a single bit during the last X seconds and could be fetched.. 2. you could try the old fashioned way, and expect a md5-checksum-file for each incoming file.. this is the most secure way for your data, but I fear not the most favorized one. some ideas only.. hope that helps a little, markus