Cron job script problem

Discussion in 'PHP' started by colin008, Aug 4, 2006.

  1. #1
    I hope some one can answer my question...

    My website host company only alows me to run a Cron job every hour, however i need my php script to run every 5 minutes.

    So what i want to do is set up my php script to be Cron'ed every hour, then wait 5 miniutes and run the script again, the php script itself will only last 2 seconds...

    My question is after the script has ran for 2 seconds, would the 5 minute wait put any load on the server ?
     
    colin008, Aug 4, 2006 IP
  2. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The short answer is no, there wouldn't be load from it but the long answer is that it's probably a futile effort. If they only let you cron once an hour, they're not going to let you run the script indefinitely (even though it's waiting, it's still technically 'running').

    I'd suggest setting up an external cron job that just hits the page on your site whenever you want it to. There are a number of sites that do this for a fee, or if your home internet connection is decent, just set it up on your PC.
     
    TwistMyArm, Aug 4, 2006 IP
  3. coderlinks

    coderlinks Peon

    Messages:
    282
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yea, you can also use a free webhost or maybe another webhost that doesn't have such restrictions. Like:
    http://x10host.com/

    Then you can use the 'wget' or the 'lynx' command within the Cron job to call up your PHP script on your current host every 5 minutes.

    Thomas
     
    coderlinks, Aug 4, 2006 IP
  4. colin008

    colin008 Active Member

    Messages:
    162
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    68
    #4
    Thats interesting, problem is http://x-10hosts.com is showing lots of MySql database errors, is there another free webhost that alows this ?
     
    colin008, Aug 4, 2006 IP
  5. coderlinks

    coderlinks Peon

    Messages:
    282
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #5
    x10hosting.com :D This one's different. There are lots of free PHP hosts out there.
    Here is a list of free PHP webhosts. They usually have CPanel support.

    http://www.0php.com/free_PHP_hosting.php

    If you have your own domain, PM me to get a link to free hosting :D

    Thomas
     
    coderlinks, Aug 5, 2006 IP