Cron jobs does not run

Discussion in 'Installation/Configuration' started by George Girgolas, Mar 27, 2019.

Tags:
  1. George Girgolas

    George Girgolas New Member

    Hello all
    ISPConfig 3 on Centos.
    I've changed The
    Clients->Edit Client -> Limits -> Cron Jobs Limit
    Max. number of cron jobs = 100
    Max. Allowed Cronjob types = Full Cron

    Now when I create a new cron job through isp panel, a file is generated at /etc/cron.d/ called ispc_webXX (where XX is the number).
    The contents of this file is

    Code:
    MAILTO=''
    SHELL='/bin/sh'
    
    41      19      *       *       *       web16   /usr/bin/wget --no-check-certificate --user-agent='Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0' -q -t 1 -T 7200 -O /var/www/clients/client1/web16/private/cron_wget.log 'http://web16.leptserv.georgeapps.gr/update_products/sqli_update_elastika.php' >>/var/www/clients/client1/web16/private/cron.log 2>>/var/www/clients/client1/web16/private/cron_error.log #elastika4u.gr
    
    In the cron job I create in ispconfig panel, in textbox "command to run" I type only the url
    Code:
    http://web16.leptserv.georgeapps.gr/update_products/sqli_update_elastika.php
    if i run the url in a browser,it is executed perfect.
    If i run the command
    Code:
    /usr/bin/wget --no-check-certificate --user-agent='Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0' -q -t 1 -T 7200 -O /var/www/clients/client1/web16/private/cron_wget.log 'http://web16.leptserv.georgeapps.gr/update_products/sqli_update_elastika.php' >>/var/www/clients/client1/web16/private/cron.log 2>>/var/www/clients/client1/web16/private/cron_error.log
    directly to cli (as user root) it is executed just fine.

    So what is wrong?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The cronjob looks fine. You configured it to run at 19:41, check with date command on the shell what the time on your system to ensure that it is not past 19:41 yet, otherwise it will run tomorrow at that time.
     
  3. George Girgolas

    George Girgolas New Member

    Unfortunately I've check over 10 times the date on the server, every time i adjust it to run after 2-3 minutes after I complete the changes.
    Nothing happens, nor the cron job file log is created!
     
  4. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    make sure cron is running
     
  5. George Girgolas

    George Girgolas New Member

    The output of the command
    Code:
    systemctl status -l crond
    is "running"
     
  6. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    have you tried running it on the cli as the user rather than root?
    does /var/www/clients/client1/web16/usr/bin/wget exist?
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    That's a URL cron which means that it is not chrooted (you can see that in the cronjob line "SHELL='/bin/sh'", so it calls the system wget in / and not usr/bin/wget /var/www/clients/client1/web16/usr/bin/wget
     
  8. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    That's good .. maybe create a quick test to make sure it is working. Eg. add a line to that same cronjob file that runs "/usr/bin/touch /tmp/cron_is_running" every minute, and ensure that tmp file is created and timestamp updates.
     
  9. George Girgolas

    George Girgolas New Member

    So I think it's a user permission error. As soon as I changed the web16 part in the /etc/cron.d/ispc_web16 file, from web16 to root, the cron completed succesfully.

    Code:
    41      19      *       *       *       web16   /usr/bin/wget --no-check-certificate --user-agent='Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0' -q -t 1 -T 7200 -O /var/www/clients/client1/web16/private/cron_wget.log 'http://web16.leptserv.georgeapps.gr/update_products/sqli_update_elastika.php' >>/var/www/clients/client1/web16/private/cron.log 2>>/var/www/clients/client1/web16/private/cron_error.log #elastika4u.gr
    
    So is there a solution for this?
     
  10. George Girgolas

    George Girgolas New Member

    Any updates on this issue?
     
  11. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    I don't know what might be wrong offhand, and don't have any Centos boxes to compare to. FWIW, this is a working cron job from a debian 9 system:
    Code:
    MAILTO=''
    SHELL='/bin/sh'
    
    */30    *       *       *       *       web10   /usr/bin/wget --user-agent='Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0' -q -t 1 -T 7200 -O /dev/null 'http://www.domain.com/wp-cron.php' >/dev/null 2>&1 #domain.com
    That looks nearly identical to yours (though yours does have the '--no-check-certificate' wget option). Don't know if it's helpful but if you want to compare:
    Code:
    # grep ^web10: /etc/passwd
    web10:x:10010:1005::/var/www/clients/client3/web10/./home/user123:/usr/sbin/jk_chrootsh
    
    # dpkg --list | grep cron
    ii  cron               3.0pl1-128+deb9u1                 amd64        process scheduling daemon[/cron]
     

Share This Page