Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How do I run a cron job?

Discussion in 'General Discussion' started by SharonGilmore, May 5, 2011.

  1. SharonGilmore

    SharonGilmore Member

    Joined:
    May 5, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    51
    I'm trying to set up a cron job on my server. I've gone the the cron job option in cPanel, but I'm not sure how to set it up.

    The scheduling part is fine, but the actual script doesn't run, so I'm thinking I've got it wrong. I can't find any documentation that tells me how to execute a php script, or what I should have as the path to the script.

    My login is pubfish, so currently I have:
    /usr/local/bin/php -q /home/pubfish/public_html/reminder.php

    but I'm not getting the confirmation emails to say whether it worked.

    Is this the correct set up? If not, what should I change?

    If it looks ok, does this indicate that there's an error in the php script? How do I check where that might be?

    Thanks!
    Sharon
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,609
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello Sharon,

    Have you input your email into the "Cron Email" area for the email field there? The only reason I could see that no emails would be sent would be that no email has been set in that section.

    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. SharonGilmore

    SharonGilmore Member

    Joined:
    May 5, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    51
    Yes, I've put my email address in there. What's meant to happen? Should the email send whether it works or not? Or does the fact that I'm not getting an email indicate that the script didn't complete?
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,609
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    If there were an error, it would email you the error, but it likely will not email if the cron executes successfully unless the script being processed has it set to email some output on completion.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. SharonGilmore

    SharonGilmore Member

    Joined:
    May 5, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    51
    Ah, ok. So if I put in a line of code at the end that emails me to say it's done, then that should work? Will try it and see. Thanks for your help.
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice