Cron job questions

Discussion in 'Site & Server Administration' started by georgechristodoulou, Apr 5, 2007.

  1. #1
    Hello,

    I want to install software that posts RSS feeds from other sites onto my blog. I installed it into my plugin area and I also installed the file that allows you to update the RSS feed which creates the posts.

    The problem is that to automate it, you need to create a cron job and I dont know if Im writing the code into the line correctly.

    They tell you to write in,

    25 * * * * cd $HOME/www/wp/wp-content ; php -q update-feeds.php

    Im gussing the number and stars refer to the amount of time it should be updated. I dont know if Im writing the rest correct because its not updating. Also, my blog is in the main directory.

    Thanks,

    George Christodoulou
     
    georgechristodoulou, Apr 5, 2007 IP
  2. stugs

    stugs Peon

    Messages:
    157
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Your cron job is setup to run every 25 minutes.

    The asterisks are
    Minute
    Hour
    Day of Month
    Month
    Day of Week

    I would change the command to

    25 * * * * /usr/bin/php -q /home/username/www/wp/wp-content/update-feeds.php

    If that doesn't work, try

    25 * * * * /usr/bin/php -q /home/username/www/wp/wp-content/update-feeds.php > /tmp/update-feeds-output.txt

    Then after you are 25 minutes past the hour go into the tmp directory and 'cat update-feeds-output.txt' and see what the error is. By putting the pipe at the end it will send all output to a file. This is usually the best way to see why a script isn't executing correctly.

    This assumes the PHP-CLI executable is indeed in /usr/bin. You can find out for sure by typing 'which php' from a command prompt.
     
    stugs, Apr 5, 2007 IP
  3. monkeysurfer

    monkeysurfer Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    well this line is wrong
    You don't have the $HOME outside php
    use this but if the path is not correct contact your support:
    replace the username with your username
     
    monkeysurfer, Apr 5, 2007 IP
  4. MGOB

    MGOB Peon

    Messages:
    91
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    once you get it right however you'll want to add the -q to avoid excessive e-mails from system.
     
    MGOB, Apr 5, 2007 IP
  5. Artisan

    Artisan Well-Known Member

    Messages:
    634
    Likes Received:
    35
    Best Answers:
    1
    Trophy Points:
    128
    #5
    Your cron job would run at the 25-th minute of the every hour.
    You may configure your home directory in the cron job file also.
    It would be better to use complete path names for everyting.

    HOME=/home/user/www/wp/wp-content
    25 * * * * /usr/local/bin/php -q /home/user/www/wp/wp-content/update-feeds.php
     
    Artisan, Apr 5, 2007 IP
  6. ThreeGuineaWatch

    ThreeGuineaWatch Well-Known Member

    Messages:
    1,489
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    140
    #6
    One other thing to bear in mind is that you will get mail from crond every hour, which can mount up. If you do not want this then you should redirect stdout and stderr to /dev/null
     
    ThreeGuineaWatch, Apr 6, 2007 IP