SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2010
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    cron not running...

    Hi,

    The current cron does not run.

    0 23 * * * root php -d safe_mode="off" /home/[sitename]/public_html/script.php 1>/tmp/1.txt 2>/tmp/2.txt

    How do I know this ? script.php should generate an xml and it fails doing that. If I run the script in a browser www.sitename.com/script.php it runs ok and it generates the file.

    Can you tell me what could be set up wrong here ?

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,097
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Cron doesn't have the same path you have when logged in. To overcome this problem I always make sure every path I type for cron is absolute.

    In this case I would change php in the command with /usr/bin/php or wherever your php executable is located (if you're not sure type "whereis php" on the command line).
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try to run the command from commandline without redirecting the output:
    php -d safe_mode="off" /home/[sitename]/public_html/script.php

    Possibly, you'll see the errors.

    Also, try to check the files /tmp/1.txt and /tmp/2.txt

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2010
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your replies.

    I don't have access on the server and the admin says the cron set-up looks ok and that I should take a look at the php script. The cron run just fine up until a week or so ago. I don't know what could have changed. I will take a look at the path again.

    2.txt contains 2 notices and I'm almost sure this is not the problem. 1.txt is empty.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2010
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can try setting it up with wget or lynx as:

    lynx -dump http://www.sitename.com/script.php >> /tmp/1.txt

    or;

    lynx -dump http://www.sitename.com/script.php > /dev/null

    or;

    /usr/bin/wget --quiet "http://www.sitename.com/script.php"


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
  •