The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

need syntax help for cron job

Discussion in 'General Discussion' started by jmacie, May 14, 2014.

  1. jmacie

    jmacie Registered

    Joined:
    May 14, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    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
     
    #1 jmacie, May 14, 2014
    Last edited by a moderator: May 14, 2014
  2. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    817
    Likes Received:
    22
    Trophy Points:
    18
    Location:
    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/
    
     
  3. jmacie

    jmacie Registered

    Joined:
    May 14, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    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.
     
  4. jmacie

    jmacie Registered

    Joined:
    May 14, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    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.
     
  5. cPanelPeter

    cPanelPeter Technical Analyst III
    Staff Member

    Joined:
    Sep 23, 2013
    Messages:
    569
    Likes Received:
    15
    Trophy Points:
    18
    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/
    
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page