n14charlie Posted August 30, 2009 Share Posted August 30, 2009 Heya I need to run a PHP script every X seconds, so I tried using cron with sleep but I can't have them overlapping...any simple solution for this? Link to comment https://forums.phpfreaks.com/topic/172487-run-php-script-every-x-seconds/ Share on other sites More sharing options...
abazoskib Posted August 30, 2009 Share Posted August 30, 2009 use touch() to create a lock file -- a blank file, with any name you want. at the very beginning of the script check for the existence of the lock file(is_file()), if it exists exit(), else proceed then use unlink() to remove the lock file when the script is complete Link to comment https://forums.phpfreaks.com/topic/172487-run-php-script-every-x-seconds/#findComment-909381 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.