PDA

View Full Version : Continuously looping a single script


m002.p
06-08-2009, 10:29 PM
Hi guys,

I am attempting to get a PHP script which checks a gameserver, to run continously using CRON as a kick.

I have a system in place on UNIX allowing my script to not overlap and only run once at a time.

Anyone got any suggestions with the best way to loop a script continuously or run it every 3 seconds?

Note, I use functions in this script which usually results in the 'cannot redeclare function' error if I try the usual methods of running scripts more often than CRONs 1 min. Anyway round this than expanding the functions into regular code?

Thanks in advance

Matt

Dismounted
06-09-2009, 06:53 AM
You could maybe achieve this using sleep() and normal loops.

m002.p
06-09-2009, 08:22 PM
Any example as I am really having difficulties with this continuous loop thing?

Thanks for the reply Dismounted.