diff --git a/database.sql b/database.sql index 5b4fd20..b0436fb 100644 --- a/database.sql +++ b/database.sql @@ -59,6 +59,7 @@ CREATE TABLE IF NOT EXISTS `jobs` ( `host` varchar(50) NOT NULL DEFAULT 'localhost', `delay` int(11) NOT NULL, `nextrun` int(11) NOT NULL, + `lastrun` int(11) NOT NULL DEFAULT '-1', `expected` int(11) NOT NULL DEFAULT '200', PRIMARY KEY (`jobID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/webcron.php b/webcron.php index 29a56fe..7a554f8 100644 --- a/webcron.php +++ b/webcron.php @@ -67,7 +67,7 @@ if (file_exists("cache/get-services.trigger")) { } } -$stmt = $db->prepare('SELECT jobID, url, host, delay, nextrun, expected FROM jobs WHERE nextrun <= ?'); +$stmt = $db->prepare('SELECT * FROM jobs WHERE nextrun <= 1558742600 and (nextrun <= lastrun OR lastrun = -1)'); $stmt->execute(array(time())); $results = $stmt->fetchAll(PDO::FETCH_ASSOC); $client = new \GuzzleHttp\Client();