Page 2 of 2

Posted: Wed Aug 15, 2007 8:45 pm
by s.dot
Well, if going by the above post.. you wouldn't need two scripts.

Code: Select all

ignore_user_abort(true);
set_time_limit(0);

while(true)
{
     //actions here
     sleep(100); // or how many ever seconds you want the script to be halted for
}
Of course there is a problem here. If the server shuts off or apache stops running or many other things.. the script will not be executing. It should be performed as a cron job.

A cron job is a task that the server does automatically (without anyone visiting a page). A lot of control panels offer an interface to cron, making it easy to set up a cron.

Yours might look like this

Code: Select all

/usr/bin/php /home/myaccount/public_html/my_script.php
In the first part of that, /usr/bin/php is the path (or changed to the path) of php on your server. The second part is the location of the script you want to be ran automatically.

You can set your cronjobs to run every second, every minute, hour, day, etc etc etc... any time you want.

Posted: Wed Aug 15, 2007 8:58 pm
by VladSun
scottayy wrote:You can set your cronjobs to run every second, every minute, hour, day, etc etc etc... any time you want.
In crond the minimal interval is 1 minute ...