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? Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.