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.

Time Script not working.... in Cron JOb

Discussion in 'General Discussion' started by kiwis, Jan 7, 2009.

  1. kiwis

    kiwis Registered

    Joined:
    Dec 17, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hi have a cron job working and it does everything find apart from when adding my feed to the database it does not add the time. When I call the page direct it adds so the code is fine.

    Why does it not get the time? is it my cron command? which is as follows?

    /usr/local/bin/php -q /home/mysite/public_html/cron_rss_feed.php


    This is how I get the time, either the code or the require script. Neither work

    PHP:
    $Int 2;
    $set_base_nowtime strtotime("now");
    $set_base_nztime $set_base_nowtime + (3600 $Int);
    $set_base_date date ('Y-m-d'$set_base_nowtime + (3600 * + $Int));
    $set_base_date_today date ('D jS M'$set_base_nowtime + (3600 * + $Int));
    $set_base_time date ('g:i:s a'$set_base_nowtime + (3600 * + $Int))

    require(
    '../time.php'); 
     
  2. kiwis

    kiwis Registered

    Joined:
    Dec 17, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Any idea anyone?
     
  3. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    My guess is that the ../ path is not working in your require.

    This is probably because your working directory when you are testing it from the command line is not the same as the working directory when it runs from cron.

    The default working directory whjen a cronta command runs is the home directory for the user who owns the crontab.
     
Loading...

Share This Page