Preventing Cron Job Collision by spiral June 3, 2017 Note Prevents jobs to collide if they take longer to run than the frequency itself $fp = fopen(‘/tmp/lock.txt’, ‘r+’); if(!flock($fp, LOCK_EX | LOCK_NB)) { echo ‘Unable to obtain lock’; exit(-1); } /* … */ fclose($fp); Tags:collisioncronphp