0

My question is I have a wget cron job setup in cpanel and it does not work.. I mean the cron job is running but the work inside code is not happening...

But when I just enter the same URL in the browser the code get executed successfully...

So can some one tell me what is exactly equal situation command in wget as like we are performing a browser request

current cron looks like this. I am using Zend php framework

wget -b http://www.**myhost**/index/db-backup

2 Answers2

1

If you have curl enabled - you could just do this as your cron entry:

 curl http://www.**myhost**/index/db-backup

Then it is exactly as if you hit the address in a browser

If you dont want any data dump from the cron output - you can do this

 curl http://www.**myhost**/index/db-backup > /dev/null 2>&1
Laurence
  • 58,936
  • 21
  • 171
  • 212
  • Seems like something is blocking your connection. Probably the same reason `wget` is not working. Are there any firewall restrictions? – Laurence Dec 27 '14 at 05:00
  • http://stackoverflow.com/questions/9922562/how-to-resolve-curl-error-7-couldnt-connect-to-host – Laurence Dec 27 '14 at 05:01
1

The http request using wget and your browser may differ. That may cause some troubles in application. You may want to debug your http request with wget --debug URL option. For simple crawling for cron purpose wget has spider option wget --spider URL

http://www.gnu.org/software/wget/manual/wget.html

Michal Vrchota
  • 326
  • 2
  • 6