Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 6 of 6

This is a discussion on Cron jobs in the Shared & Semi-Dedicated forum
Getting errors on cron. cron.php is in my public_html dir. Originally I was getting permission denied, so I set the file to 744, now I ...

  1. #1
    xan
    xan is offline
    JPC Member
    Join Date
    Sep 2006
    Posts
    7

    Cron jobs

    Getting errors on cron.

    cron.php is in my public_html dir.

    Originally I was getting permission denied, so I set the file to 744, now I get the following:
    Code:
    /home/<user name>/public_html/cron.php: line 1: ?php: No such file or directory
    /home/<user name>/public_html/cron.php: line 2: //: is a directory
    /home/<user name>/public_html/cron.php: line 4: /aquota.user: Permission denied
    /home/<user name>/public_html/cron.php: line 5: access-logs: command not found
    /home/<user name>/public_html/cron.php: line 6: syntax error near unexpected token `('
    /home/<user name>/public_html/cron.php: line 6: ` * Handles incoming requests to fire off regularly-scheduled tasks (cron jobs).'
    I replaced my username with <user name> above.

    Any ideas?

  2. #2
    xan
    xan is offline
    JPC Member
    Join Date
    Sep 2006
    Posts
    7
    Forget this, I have now done some more searching online and used the following:
    Code:
    /usr/bin/wget -O - -q -t 1 http://www.domain.com/cron.php
    And this works. So it's solved, unless anyone knows of a better solution.

  3. #3
    the Windlord Gwaihir's Avatar
    Join Date
    Jun 2002
    Posts
    2,562
    You were running the script without telling cron that it is a php script. Looks like it tries to handle it as a shell script (a series of shell commands).

    Instead of /home/<user name>/public_html/cron.php, the command to run is php -f /home/<user name>/public_html/cron.php . I.e. you tell cron to run php and tell php to run your script.


    The downside of the wget approach is that your script must be accessible from the internet. I.e. anyone who will access http://www.domain.com/cron.php will be running that script at any time. This could be akward for a variety of reasons. So, if you stick with wget, you'll probably want to add password protection.
    Regards,

    Wim Heemskerk
    ---
    Visit MeCCG.net - Cardgaming in J.R.R. Tolkien's Middle-earth
    And Gwaihir.net - The Middle-earth CCG store

  4. #4
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    Quote Originally Posted by Gwaihir View Post
    So, if you stick with wget, you'll probably want to add password protection.
    Or restrict access to that script to localhost.

    If I were you, though, I'd go with Gwaihir's first sucggestion and set up the cron job to run PHP and have PHP run the script. I'd also move the cron.php out of the public_html directory so that it isn't accessible to the web at all, that way you don't have to worry about anyone finding it accidently.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  5. #5
    xan
    xan is offline
    JPC Member
    Join Date
    Sep 2006
    Posts
    7
    Ah, didn't even think about adding a command for a local script.. This was the first time I have used cron jobs.

    It is a Drupal setup, but I modified the cron.php to check the last time it was successfully run and not to re-run it if it was completed the last hour.

    I will probably leave it with wget for now though.

  6. #6
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    I wouldn't worry too much about running the Drupal cron through the web, nor about how often it runs. It isn't doing a whole lot except cleaning up junk it the database and stuff like that. I supposed some modules could do other things with it, but any of the ones I've used don't seem to do anything too taxing or overly sensitive with cron. If someone runs it out of schedule, oh well, no big deal.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •