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.

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:
    1
    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,623
    Likes Received:
    21
    Trophy Points:
    38
    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!
     
  3. SharonGilmore

    SharonGilmore Member

    Joined:
    May 5, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    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,623
    Likes Received:
    21
    Trophy Points:
    38
    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.
     
  5. SharonGilmore

    SharonGilmore Member

    Joined:
    May 5, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    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