I want to hit a URL of my application through cron job. I have done the following things:
1) Opened the terminal
2) Did crontab -e
which gives me an editor that allows me to put statements
3) Pasted the URL that needs to be hit after specified interval of time:
curl -s http://www.example.com/controller/function_to_execute
This cron job will run every minute
4) Saved the cron and again on terminal did crontab -l
, and I could see my cron
This scheduler isn't working, don't know why. I tried curl
on the terminal directly expecting some output, but after 5 minutes it gives me the result
curl: (7) couldn't connect to host
If I hit my URL on browser directly then my job gets successfully executed!
Have I made some mistake while making entry in the cron?