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.

cron doesnt run correctly my php file

Discussion in 'General Discussion' started by cadrogui, Jan 2, 2012.

  1. cadrogui

    cadrogui Registered

    Joined:
    Jan 2, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    hello, i have a serius problem with cron, when i run my php file manually from shell runs fine, but when i run from cron runs poorly, ive made a bash script to do this job.

    this is a extract of the code:

    -rit )
    cd /home/legalint/public_html/robot/
    php -f robot_LegalInt.php
    ;;

    so, when i call the script from shell robot -rit, says

    ---------------------------------------------------------
    C-4370-2009 | (Causa 1 de 291)
    Bytes Actuales: 480924
    Bytes en Bd: 480924
    CABELLO INMOBILIARIA BOS
    2 Juzgado Civil de Chillan
    ------------------------------------------------------------

    when i run this comand (robot -rit) from cpanel cron job, says

    ---------------------------------------------------------
    C-4370-2009 | (Causa 1 de 291)
    Bytes Actuales:
    Bytes en Bd: 480924
    CABELLO INMOBILIARIA BOS
    2 Juzgado Civil de Chillan
    ------------------------------------------------------------

    the Bytes Actuales: is empty...

    why works when i ran from shell directly, and doesnt work from cron?

    thanks
     
  2. NixTree

    NixTree Well-Known Member

    Joined:
    Aug 19, 2010
    Messages:
    386
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Gods Own Country
    cPanel Access Level:
    Root Administrator
    Hello,

    As what user you run it as cron; do you use the same user to try the script using command line? If not, su to the user you are using to run the cron and execute the script again from that user's shell.

    Thank you,
    Nibin.
     
  3. Eric

    Eric Administrator
    Staff Member

    Joined:
    Nov 25, 2007
    Messages:
    746
    Likes Received:
    11
    Trophy Points:
    18
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    Howdy,

    Can you run the script as the user using?

    Code:
    php -f  /home/legalint/public_html/robot/robot_LegalInt.php
    
    You might need the path to php too.

    Thanks!
     
Loading...

Share This Page