Using WGET in a Cronjob not working


#1

Hello,

I am using the following line in the cronjob web panel on dreamhost:

/usr/bin/wget -O - -p http://thetopcom.com/grab.php?cat=Illusion&r=illusions&s=358240

the cronjob does run since I get a confirmation email, but the script isnt running because in the email it says:

“Location: http://www.thetopcom.com/grab.php?cat=Illusion

which i imagine means that the url got cut off after “Illusion”, how to i get wget to use the whole URL that i give it and not cuttoff??

Any help would be appreciated.

Thanks,

Jon


#2

Stick quotation marks around the URL.


#3

alright, that worked, now in the email it says the whole URL that i gave it. But, i dont feel as though its actually loading the URL or visiting it, because in my data base I keep track of every page visit, and this one is not showing up. Any ideas??


#4

You do realize the "Location: " line is indicative of a redirect? When I visit the URL, I get a 404 instead. The output from wget should tell you if it followed a redirect and indicate what it downloaded. It seems like you are leaving out details.


#5

Here is the actually cron, I had edited the URL for security reasons sorry,

/usr/bin/wget -O - -p “http://www.thetopcom.com/grab_topics.php?cat=Funny&r=funny&pass=wrong_pass

Do you see anything wrong with this? It doesnt seem to be running either now, its set to run every 10 minutes…


#6

And now that URL returns a status code 200 with no content. Why don’t you try testing the URL in a browser first unless that is expected behavior. Then try running the command from a shell session.

Also, try dropping the -p parameter. wget hung when I tried it from a shell session. You don’t need to download the CSS/images etc do you?


#7

Thanks for helping! I think i finally got it to work. Sorry the URL didn’t work, my editor for some reasons crashes sometimes and deletes the whole file, so you were looking at an empty file for sure haha. Luckily i had it backed up… But removing the -p seemed to be the issue. Thanks!