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.

user cron jobs not working

Discussion in 'General Discussion' started by WorkinOnIt, Aug 30, 2016.

Tags:
  1. WorkinOnIt

    WorkinOnIt Well-Known Member

    Joined:
    Aug 3, 2016
    Messages:
    49
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    UK
    cPanel Access Level:
    Root Administrator
    I'm running cpanel 58.0.24

    I can add cron jobs under root or user in cPanel but they are not firing.

    2 * * * * wget -q -O - http://mydomain.com/wp-cron.php?doing_wp_cron >> /tmp/test.log 2>&1

    Produces the following in var/log/cron

    myvps /usr/bin/crontab[14960]: (USER) LIST (USER)
    myvps /usr/bin/crontab[14961]: (USER) REPLACE (USER)
    myvps crond[1767]: (USER) RELOAD (/var/spool/cron/USER)

    Permissions are 755 on usr/bin/crontab

    # crontab -l does not show the crons


    Any suggestions?
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,478
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Have you had a chance to review the docs for cron jobs?
    Cron Jobs - Version 56 Documentation - cPanel Documentation

    Note item #2:
     
  3. WorkinOnIt

    WorkinOnIt Well-Known Member

    Joined:
    Aug 3, 2016
    Messages:
    49
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    UK
    cPanel Access Level:
    Root Administrator
    Thanks for your reply.

    Yes, I have read that. I can't get the cron to fire at all. I am not even getting any email notification or errors.

    var/log/cron simply shows - but I do not see any RUN

    myvps /usr/bin/crontab[14960]: (USER) LIST (USER)
    myvps /usr/bin/crontab[14961]: (USER) REPLACE (USER)
    myvps crond[1767]: (USER) RELOAD (/var/spool/cron/USER)
     
  4. WorkinOnIt

    WorkinOnIt Well-Known Member

    Joined:
    Aug 3, 2016
    Messages:
    49
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    UK
    cPanel Access Level:
    Root Administrator
    System Crons are working - just not cron jobs set up through cPanel user
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you verify which version of EasyApache is installed on this system? Also, do you receive a specific error message when manually running the command used in that cron via SSH in the jailed shell environment?

    Thank you.
     
  6. WorkinOnIt

    WorkinOnIt Well-Known Member

    Joined:
    Aug 3, 2016
    Messages:
    49
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    UK
    cPanel Access Level:
    Root Administrator
    I am using Easy Apache 3 and no, there is no error.

    I've created a simple mail script in php and tested it from command line - it works fine.

    I then set up cron job to test and it also works fine.

    However, I am not receiving any email notifications from cron (success or failure messages).

    I've tried with two different users on the box.

    Here is the contents of var/spool/cron/user

    The test-cron.log on success shows this:

    I then modified the cron file path to create an error to test cron notification output: wget http://www.mydomain.com/nothinghere.php

    and in the test-cron.log I see the error (404 not found) but still no email notification is sent to the user email address as specified on the cPanel > Cron Email (and nothing to root either)

    Thanks
     
  7. WorkinOnIt

    WorkinOnIt Well-Known Member

    Joined:
    Aug 3, 2016
    Messages:
    49
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    UK
    cPanel Access Level:
    Root Administrator
    Further to the above, there are no failures mentiones in var/log/exim_mainlog and nothing in var/log/cron - infact I've grep'd all logs and can find no entries relating to the user cpanel cron jobs.

    However, I know the cron jobs are working as I've tested successfully as mentioned previously - just no emails and nothing in logs!

    The user is currently disabled shell - I will try with jailed and normal shell to see if that makes any difference

    Very strange.
     
    #7 WorkinOnIt, Sep 2, 2016
    Last edited: Sep 2, 2016
  8. WorkinOnIt

    WorkinOnIt Well-Known Member

    Joined:
    Aug 3, 2016
    Messages:
    49
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    UK
    cPanel Access Level:
    Root Administrator
    I am now convinced this issue is to do with RESTRICT_SYSLOG in CSF - I have this set to 3 (default) but I understand this breaks cron logging. I've searched google and read through multiple CSF docs but have been unable to find a way to mitigate the lack of logging for user crons.

    [edit - I disabled CSF and that hasn't changed anything - sadly]

    Some advice would be appreciated!
     
    #8 WorkinOnIt, Sep 2, 2016
    Last edited: Sep 2, 2016
  9. WorkinOnIt

    WorkinOnIt Well-Known Member

    Joined:
    Aug 3, 2016
    Messages:
    49
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    UK
    cPanel Access Level:
    Root Administrator
    Thanks to cPanel support, I was able to resolve this by setting RESTRICT_SYSLOG in CSF to "2" and also not logging to the test.log file.

    This is really not a permanent solution so I will follow up with CSF forum.
     
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    I'm happy to see the issue is now resolved. Thank you for updating us with the outcome.
     
Loading...

Share This Page