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.

Cronjobs Syntax error - need Advise

Discussion in 'General Discussion' started by GuiPos, Oct 1, 2003.

  1. GuiPos

    GuiPos Well-Known Member

    Joined:
    Jul 9, 2003
    Messages:
    59
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Indonesia / Germany
    Hello Forum Member

    i have a php script which should running every 15 min as a cron job

    its located in /home/*****/public_html/*****/*****/serv_cron.php

    if i put in the cpanel cronjob manager only the path to this
    file i get follow error message:

    /home/****/public_html/****/*****/serv_cron.php: ?
    : No such file or directory
    /home/****/public_html/****/*****/serv_cron.php: line 2: syntax error near unexpected token `include("../config.php")'
    /home/****/public_html/****/*****/serv_cron.php: line 2: `include("../config.php"); '

    can someone please hlp me to bring light in this problem or to point me in the right direction ?
    What i have to type in in the cronjob manager ?

    Thank you for your help!

    cPanel.net Support Ticket Number:
     
  2. Jemshi

    Jemshi Well-Known Member

    Joined:
    Sep 11, 2003
    Messages:
    210
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    I think you have missed the /usr/bin/php (interpreter).

    crontab -l from your login should show something like this.

    * * * * * /usr/bin/php _full_path_to_script

    thats all.

    cPanel.net Support Ticket Number:
     
  3. GuiPos

    GuiPos Well-Known Member

    Joined:
    Jul 9, 2003
    Messages:
    59
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Indonesia / Germany
    Thank you for your fast answer and your help.

    the problem for me is:

    i dont have shell or telnet access - so i can only setup the crontab via Cpanel - Crontabs

    and i have no glue how to write this syntax
    :confused:

    Thank you

    cPanel.net Support Ticket Number:
     
  4. Jemshi

    Jemshi Well-Known Member

    Joined:
    Sep 11, 2003
    Messages:
    210
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    okay, then add this much from your control panel.

    /usr/bin/php _full_path_to_script

    and of course, your times also :)

    cPanel.net Support Ticket Number:
     
  5. GuiPos

    GuiPos Well-Known Member

    Joined:
    Jul 9, 2003
    Messages:
    59
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Indonesia / Germany
    Hello jemshi

    Thanx for the fast answer
    asume the script is located in a subrot folder like this:

    /home/*****/public_html/3/0815/stat_cron.php

    should i type in the path ( syntax ) like this

    sh /home/*****/public_html/3/0815/stat_cron.php

    or the syntax you type in this thread:

    /usr/bin/php /home/*****/public_html/3/0815/stat_cron.php

    i am a newbie in cpanel so please excuse me if i clarify or ask again

    Thank you
    Guido

    cPanel.net Support Ticket Number:
     
  6. Jemshi

    Jemshi Well-Known Member

    Joined:
    Sep 11, 2003
    Messages:
    210
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    dont use the sh line.. this means that you are asking the shell to execute php - this is not right.
    use the following line.

    /usr/bin/php /home/*****/public_html/3/0815/stat_cron.php

    cPanel.net Support Ticket Number:
     
  7. GuiPos

    GuiPos Well-Known Member

    Joined:
    Jul 9, 2003
    Messages:
    59
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Indonesia / Germany
    its seems to work
    i got a email :

    Failed loading /usr/local/Zend/lib/ZendOptimizer.so: /usr/local/Zend/lib/ZendOptimizer.so: undefined symbol: zend_execute_internal
    X-Powered-By: PHP/4.1.2
    Content-type: text/html

    i think now the only issue is that the zend optimizer isn't working

    thankyou

    cPanel.net Support Ticket Number:
     
  8. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    */15 * * * * GET http://yourdomain.com/path/to/cron_script.php > /dev/null

    This should get that script every 15 minutes, but will not send you an email every 15 minutes telling you it finished (that would be horrible), that is were the /dev/null comes into play.

    Or so I'm told anyway. :)
    Never tried it myself so would be interested in your feedback.

    cPanel.net Support Ticket Number:
     
  9. GuiPos

    GuiPos Well-Known Member

    Joined:
    Jul 9, 2003
    Messages:
    59
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Indonesia / Germany
    Re: Re: Cronjobs Syntax error - need Advise

    Thank you - Website Rob

    But the problem - i have no shell or telnet access
    i can only configure this via cpanel - cronjobs

    and run in some small probs. :confused:

    cPanel.net Support Ticket Number:
     
  10. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    Use 'Advanced' instead of Standard within Cpanel-Cron jobs.

    cPanel.net Support Ticket Number:
     
  11. GuiPos

    GuiPos Well-Known Member

    Joined:
    Jul 9, 2003
    Messages:
    59
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Indonesia / Germany
    its hard to be a newbie -> i overlook it

    i will try right now

    Thank you

    cPanel.net Support Ticket Number:
     
  12. GuiPos

    GuiPos Well-Known Member

    Joined:
    Jul 9, 2003
    Messages:
    59
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Indonesia / Germany
    Re: Re: Cronjobs Syntax error - need Advise

    i think its work fine
    but if i dont write the email address in the header of the crontabs - cpanel then is this the same solutions ?

    Thank you very much

    cPanel.net Support Ticket Number:
     
  13. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    Not sure what you mean?

    If you do want eMails then leave off: > /dev/null

    BTW, why do you quote every post?

    cPanel.net Support Ticket Number:
     
  14. GuiPos

    GuiPos Well-Known Member

    Joined:
    Jul 9, 2003
    Messages:
    59
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Indonesia / Germany
    why i allway try to catch the postreply button but my mouse is to fast after to many cafes.:cool:

    [beginner mistake]

    what i mean is - if the cronjob can not start script
    will i receive a error message ?

    cPanel.net Support Ticket Number:
     
  15. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    That's where your own testing comes in. :D

    cPanel.net Support Ticket Number:
     
  16. GuiPos

    GuiPos Well-Known Member

    Joined:
    Jul 9, 2003
    Messages:
    59
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Indonesia / Germany
    Thank you

    Jemshi and Website Rob for your help.
    Right now its seems to work fine.
    I will wait until tomorrow, so i can see the results.


    :)

    cPanel.net Support Ticket Number:
     
Loading...

Share This Page