I want wget to (attempt to) start downloading, then if isn't done after 10 seconds, I want it to give up.

wget --timeout 10 http://url

Seems like a reasonable try, but it seems like it only sets --dns-timeout, --connect-timeout, and --read-timeout. Thus, it could wait 9 seconds for dns, another 9 for connect and then keep downloading forever, as long as data keeps coming at a steady pace (no 10+ second pause).

link|improve this question
feedback

1 Answer

Basically this will be something like:

wget http://www.somesite.com/file.zip &
PID=$!
sleep 10
if [ `ps ax | grep $PID` -ne '' ]
   then
   kill $PID
fi
link|improve this answer
That's one way to solve it, ugly as it is. – johv Feb 25 at 12:55
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.