Added locking of the script
This commit is contained in:
parent
9258ca650b
commit
1c582baa2c
|
@ -26,6 +26,12 @@
|
|||
|
||||
require_once "include/initialize.inc.php";
|
||||
|
||||
if(file_exists('cache/webcron.lock'))
|
||||
{
|
||||
die('Script is already running');
|
||||
}
|
||||
touch('cache/webcron.lock');
|
||||
|
||||
$stmt = $db->query('SELECT jobID, url, delay, nextrun FROM jobs WHERE nextrun < ' . time());
|
||||
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
|
@ -49,4 +55,6 @@ foreach ($results as $result) {
|
|||
|
||||
}
|
||||
|
||||
unlink('cache/webcron.lock');
|
||||
|
||||
require_once 'include/finalize.inc.php';
|
||||
|
|
Loading…
Reference in New Issue