Currently, I tried to prevent an onlytask.php script from running more than once:
onlytask.php
$fp = fopen(\"/tmp/\".\"onlyme.lock\", \"a+\"); if (flock($fp,
try using the presence of the file and not its flock flag :
$lockFile = "/tmp/"."onlyme.lock"; if (!file_exists($lockFile)) { touch($lockFile); echo "task started\n"; // // do something lengthy // unlink($lockFile); } else { echo "task already running\n"; }