LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cron+wget = multiple downloads (https://www.linuxquestions.org/questions/linux-newbie-8/cron-wget-%3D-multiple-downloads-708562/)

stokilo 03-02-2009 06:56 AM

cron+wget = multiple downloads
 
Hi

I have a problem with very simple combination of wget+cron on my ubuntu server.
I created file execute.cron as normal user

execute.cron :

16 * * * * wget -t 0 www.page.com > output.log

next i run : crontab execute.cron

Task was invoked properly but i as i result is should get one index.html page. When i run this from command line that is the case. Using cron i get

index.html
index.html.1
index.html.2
and so on

What can be a reason that cron + wget run multiple downloads ?


Best regards
Slawek

grepmasterd 03-02-2009 11:49 AM

use the -O (capital 'O') option to force output file to retain a static file name. wget will append a .1, .2, .3, etc to index.html if that file exists locally already -- this is normal behavior and you would have found that behavior at the command line also. prove it to yourself by running the command multiple times at the command line.

also why not use -o output.log instead of redirecting stdout to output.log?

so just to be clear, the command would look like

wget -t0 -O index.html -o output.log http://www.page.com


All times are GMT -5. The time now is 04:27 AM.