need syntax help for cron job

jmacie

Registered
May 14, 2014
3
0
1
cPanel Access Level
Website Owner
I have cpanel access, so I can set up a cron job. I verified that wget & curl are both available.

I want to load this page once a day: domain.com/daily-deals/

I've tried using this to make it load: wget -O http://www.domain.com/daily-deals/ > /dev/null

However, it does not appear to be working.

I do not have the simple php script option; I specifically need to load that URL to force the content to refresh/generate once per day.

What do I need to change to make it load that page automatically?

Thanks,
Jenn
 
Last edited by a moderator:

vanessa

Well-Known Member
PartnerNOC
Sep 26, 2006
833
28
178
Virginia Beach, VA
cPanel Access Level
DataCenter Provider
If you remove the >/dev/null from the end and set your email address in the email field to be notified, you will likely see what the issue is.

From first glance, it's the incorrect use of wget. When you pass -O, you're supposed to specify an output file:

Code:
wget -O output.txt http://www.domain.com/daily-deals/
 

jmacie

Registered
May 14, 2014
3
0
1
cPanel Access Level
Website Owner
Thanks. I switched it to this:

wget http://www.domain.com/daily-deals/

No email arrived, though it is set to send an email. And the page did not load as far as I can tell.
 

jmacie

Registered
May 14, 2014
3
0
1
cPanel Access Level
Website Owner
I've also tried this:

curl -sS http://www.domain.com/daily-deals/

Also, no email arrived though I set it to, and the page did not load as far as I can tell.

For reference: The reason I need to load this page is it's pulling info from about 6 APIs to build the page, and it takes about 30 seconds for it to load. After the initial load, it serves a cache of the info for 24 hours, at which point it dumps the cache & starts over. I'd like it to run in the middle of the night so that people don't click off when it doesn't load.
 

cPanelPeter

Technical Analyst III
Staff member
Sep 23, 2013
574
17
143
cPanel Access Level
Root Administrator
Twitter
Hello,

Have you verified that crond is actually running?

Code:
# ps auxfww | grep crond
Also, make sure you use the full path to wget or curl.

Code:
/usr/bin/wget -O output.txt http://www.domain.com/daily-deals/
or
/usr/bin/curl http://www.domain.com/daily-deals/
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
Hello :)

Note that your access level is listed as "Website Owner". You may want to consult with your web hosting provider for assistance as the troubleshooting steps are limited if you do not have root access to the server.

Thank you.