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 jobs failed

Discussion in 'General Discussion' started by Stanleytiew, Jul 25, 2006.

  1. Stanleytiew

    Stanleytiew Well-Known Member

    Joined:
    May 9, 2005
    Messages:
    143
    Likes Received:
    0
    Trophy Points:
    16
    I'm creating the following cron jobs

    5 2 * * * /home/firstonl/public_html/customer/tollfree/pw_exp_check.php

    but getting the following error:

    /bin/sh: line 1: /home/firstonl/public_html/customer/tollfree/pw_exp_check.php: Permission denied

    Can anybody help what wrong with the cronjob or what others setting required.
     
  2. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    You'd need to either put a shebang line in the script pointing to the path to the PHP executable or put the same path in the cron entry prior to the script path.

    You should also check that the script has the correct execute permissions.
     
  3. Stanleytiew

    Stanleytiew Well-Known Member

    Joined:
    May 9, 2005
    Messages:
    143
    Likes Received:
    0
    Trophy Points:
    16
    Your explanation is to general for a person who new to crob jobs, appreciate very much if you could give more details on how the command look like. Example will be much appreciated.
     
  4. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    A shebang line tells the thing that opens the script what it should use to run the script.

    Thatw would involve putting the following lines as the very first line in the PHP script:

    Code:
    #!/usr/bin/php
    The latter method would involve specifying, within the cron entry, the same path to PHP as in the shebang line.

    In your case:

    Code:
    5 2 * * * /usr/bin/php /home/firstonl/public_html/customer/tollfree/pw_exp_check.php
    You'd probably find the second option more suitable.

    As far as script permissions go, what are the permissions on /home/firstonl/public_html/customer/tollfree/pw_exp_check.php?
     
  5. Stanleytiew

    Stanleytiew Well-Known Member

    Joined:
    May 9, 2005
    Messages:
    143
    Likes Received:
    0
    Trophy Points:
    16
    Thank you very much, it is working well.
     
  6. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    Good to hear!
     
Loading...

Share This Page