Welcome to Centmin Mod Community
Become a Member

Cron Jobs not running, Magento CE 1.9

Discussion in 'System Administration' started by Afaq, Nov 16, 2015.

Tags:
  1. Afaq

    Afaq Member

    81
    3
    8
    Aug 5, 2015
    Ratings:
    +5
    Local Time:
    4:13 PM
    I've Magento 1.9 running with Centminmod on a dedicated OVH server but my cronjobs dont seem to be running.
    This is what I've in my cron file (I access it by crontab -e):
    0 */4 * * * * /usr/bin/cminfo_updater
    */5 * * * * /usr/local/bin/php -f /home/nginx/domains/domain.com/public/cron.php
    */5 * * * * /usr/bin/sh /home/nginx/domains/domain.com/public/cron.sh

    Can anyone help with it?
    Thanks in advance.

     
  2. eva2000

    eva2000 Administrator Staff Member

    54,935
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    9:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    checked your cron jon log at /var/log/cron ?
     
  3. Afaq

    Afaq Member

    81
    3
    8
    Aug 5, 2015
    Ratings:
    +5
    Local Time:
    4:13 PM
    Well, according to logs, apparently its running:
    Nov 16 12:20:01 ns339261 CROND[9183]: (root) CMD (/usr/local/bin/php -f /home/nginx/domains/domain.com/public/cron.php)
    Nov 16 12:20:01 ns339261 CROND[9184]: (root) CMD (/usr/bin/sh /home/nginx/domains/domain.com/public/cron.sh)
    Nov 16 12:20:01 ns339261 CROND[9185]: (root) CMD (/usr/lib64/sa/sa1 1 1)
     
  4. eva2000

    eva2000 Administrator Staff Member

    54,935
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    9:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yup they ran :)
     
  5. Afaq

    Afaq Member

    81
    3
    8
    Aug 5, 2015
    Ratings:
    +5
    Local Time:
    4:13 PM
    Hey, I am still facing the issue. Same lines the cron file apart from one extra line at start which sends me an email of the cron progress.
    This is what I get in the email:
    which: no php in (/usr/bin:/bin)

    Any idea how can I fix this?
     
  6. eva2000

    eva2000 Administrator Staff Member

    54,935
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    9:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    what does output of these 2 commands give ?

    Code:
    echo $PATH
    Code:
    grep PATH /root/.bashrc
    and command
    Code:
    uname -ri
    and
    Code:
    which php
     
  7. eva2000

    eva2000 Administrator Staff Member

    54,935
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    9:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    what's the extra line look like ?
     
  8. Afaq

    Afaq Member

    81
    3
    8
    Aug 5, 2015
    Ratings:
    +5
    Local Time:
    4:13 PM
    Code:
    echo $PATH
    /usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin
    Code:
    grep PATH /root/.bashrc
    export PATH="/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin :/root/bin"

    Code:
    uname -ri
    3.14.32-xxxx-grs-ipv6-64 x86_64

    and PHP 5.4.55
     
  9. Afaq

    Afaq Member

    81
    3
    8
    Aug 5, 2015
    Ratings:
    +5
    Local Time:
    4:13 PM
    MAILTO= myemail@gmail.com
     
  10. eva2000

    eva2000 Administrator Staff Member

    54,935
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    9:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    you're running OVH's custom kernel see Download - CentminMod.com LEMP Nginx web stack for CentOS

    try

    Code:
    */5 * * * * /usr/bin/env php -f /home/nginx/domains/domain.com/public/cron.php
     
  11. eva2000

    eva2000 Administrator Staff Member

    54,935
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    9:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    or you can try editing /etc/crontab and append to PATH variable /usr/local/bin

    Code:
    PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
     
  12. Afaq

    Afaq Member

    81
    3
    8
    Aug 5, 2015
    Ratings:
    +5
    Local Time:
    4:13 PM
    I just tried this. Let's see what happens. Should I do something about kernal now or it should be fine?
     
  13. eva2000

    eva2000 Administrator Staff Member

    54,935
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    9:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    OVH custom kernels have security and other restrictions so have unforseen issues in general .. so usually I wipe the server first and rebuild using CentOS distro kernel/OS template for new setups. Of course backup all your data first.
     
  14. Afaq

    Afaq Member

    81
    3
    8
    Aug 5, 2015
    Ratings:
    +5
    Local Time:
    4:13 PM
    This is what I got in the email now:
    /usr/bin/env: php: No such file or directory
     
  15. Afaq

    Afaq Member

    81
    3
    8
    Aug 5, 2015
    Ratings:
    +5
    Local Time:
    4:13 PM
  16. eva2000

    eva2000 Administrator Staff Member

    54,935
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    9:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  17. eva2000

    eva2000 Administrator Staff Member

    54,935
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    9:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    depends on your app as to what cronit.php does, wordpress does this for wp-cron php file file but such stuff is left to end users to figure out