Delete a partial download after a timeout

2007-11-06 Thread moisi
Hello,

I use wget to retrieve an XML feed. The problem is that sometimes I get timeout 
error. I used the good wget options to handle this problem, but when wget 
retries to download the file again, the data are appended to the file which 
causes a bad file. Here is wget command line:

wget -c -nc -O tmp/out.xml -t 5 -w 60 -T 60 http://url.of.the.feed/feed.xml

Can you help me to fix this problem? I am not subscribed to the list, so can 
you CC'ed me to the reply.
Thanks a lot

Sydney




  
_ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail


Re: Delete a partial download after a timeout

2007-11-06 Thread Micah Cowan
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

moisi wrote:
 Hello,
 
 I use wget to retrieve an XML feed. The problem is that sometimes I
 get timeout error. I used the good wget options to handle this
 problem, but when wget retries to download the file again, the data
 are appended to the file which causes a bad file. Here is wget
 command line:
 
 wget -c -nc -O tmp/out.xml -t 5 -w 60 -T 60
 http://url.of.the.feed/feed.xml

Hm. I'm not sure how Wget could deal with this in a general way. We
could certainly ask Wget to truncate the output-file, when the
output-file refers to a truncate-able file; but it doesn't always (such
as with -O -).

I think you'd be better off without using -O, and rename/append the file
after downloading.

I believe your use of -c and -nc with -O is not meaningful. -O is meant
to work very similarly to a redirection.

Hm... but current development Wget seems to have a regression with -nc
and -O in relation to Wget 1.10.2:

$ ls -a
. ..
$ wget -c -nc -O foo micah.cowan.name
- --2007-11-06 10:55:28--  http://micah.cowan.name/
Resolving micah.cowan.name... 66.150.225.51
Connecting to micah.cowan.name|66.150.225.51|:80... connected.
HTTP request sent, awaiting response... 200 OK
File ‘foo’ already there; not retrieving.

$

Question to group: should -nc even work with -O? And if so, I suppose
the wget-1.10.2 behavior would be the expected...

- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHMLl07M8hyUobTrERCM80AJ9ZR0qJfFNdvebtlXVuhvkZpAJ1AwCeI90T
C46dvepWUA5Kw47lVrDfYGg=
=LA8j
-END PGP SIGNATURE-