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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can't get Cron job to run

Discussion in 'General Discussion' started by arobbert, Mar 1, 2017.

Tags:
  1. arobbert

    arobbert Registered

    Joined:
    Mar 1, 2017
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    holland
    cPanel Access Level:
    Website Owner
    I'm attempting to get this simple Cron command to run from the Cron jobs panel.
    ** * * * * find /home/CPANELUSERNAME/public_html -mtime -1 \! -type d -ls

    The purpose of the command is to alert me when a file changes. CPANELUSERNAME has been changed to my user name and I have set an email address in "send an email when a job runs".

    To test this I alter a simple text file in the public_html folder. I don't receive a message indicating the change. I contacted my hosting service Godaddy. They tested Cron functionality on the server. Initially it didn't work. After some adjustments they were able to verify that it is working on the server. However I can't get this to work from inside the control panel.

    Any help would be greatly appreciated.
     
  2. SB-Nick

    SB-Nick Well-Known Member

    Joined:
    Aug 26, 2008
    Messages:
    175
    Likes Received:
    9
    Trophy Points:
    68
    cPanel Access Level:
    Root Administrator
    Hello,

    Looks like you have an extra "*" there.
    Additionally, make sure there is a MAILTO= line with your email address at the top of the cronjob.

    If it's still not working I would try using a shell script instead.
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,659
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    It's possible the account does not have permission to utilize the "find" command. You can access the account via SSH if your hosting provider allows it to try running that command manually. If you don't have SSH access, ask your hosting provider to run the command in the jailed environment as the account username to verify it works as expected.

    Thank you.
     
  4. arobbert

    arobbert Registered

    Joined:
    Mar 1, 2017
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    holland
    cPanel Access Level:
    Website Owner
    Thanks for your reply. The extra ** was a typo in my post. It reads
    * * * * * find /home/CPANELUSERNAME/public_html -mtime -1 \! -type d -ls
    In the Job.

    I have limited knowledge and am not familiar with shell scripts. Is this something I can do in cpanel?

    I don't have SSH Access. It looks like it will take a day or so to activate it. Godaddy won't touch code for me.
     
    #4 arobbert, Mar 1, 2017
    Last edited by a moderator: Mar 1, 2017
  5. arobbert

    arobbert Registered

    Joined:
    Mar 1, 2017
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    holland
    cPanel Access Level:
    Website Owner
    I suspect that Cron is not working for me on godaddy. Can anyone recommend a simple command I can use to test it from within cPanel?
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,659
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    You can't directly check if the crond service is running from within cPanel. You'd need to reach out to your hosting provider to have them look for any issues.

    Another option is to try setting up a different cron job that uses something other than the "find" command to rule that command out as the culprit.

    Thank you.
     
  7. arobbert

    arobbert Registered

    Joined:
    Mar 1, 2017
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    holland
    cPanel Access Level:
    Website Owner
    Thanks I'll give that a try.
     
Loading...

Share This Page