2014-01-07 19:24:48 +00:00
|
|
|
<?php
|
2014-01-07 22:32:57 +00:00
|
|
|
/**
|
|
|
|
* PHP Server Monitor
|
|
|
|
* Monitor your servers and websites.
|
2014-01-07 19:24:48 +00:00
|
|
|
*
|
|
|
|
* This file is part of PHP Server Monitor.
|
|
|
|
* PHP Server Monitor is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* PHP Server Monitor is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
|
2014-01-07 22:32:57 +00:00
|
|
|
*
|
|
|
|
* @package phpservermon
|
|
|
|
* @author Pepijn Over <pep@neanderthal-technology.com>
|
|
|
|
* @copyright Copyright (c) 2008-2014 Pepijn Over <pep@neanderthal-technology.com>
|
|
|
|
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
|
|
|
|
* @version Release: @package_version@
|
2014-02-10 22:48:43 +00:00
|
|
|
* @link http://www.phpservermonitor.org/
|
2014-01-07 22:32:57 +00:00
|
|
|
**/
|
2014-01-07 19:24:48 +00:00
|
|
|
|
|
|
|
// include main configuration and functionality
|
2014-01-10 17:31:57 +00:00
|
|
|
require_once dirname(__FILE__) . '/../src/bootstrap.php';
|
2014-01-07 19:24:48 +00:00
|
|
|
|
2014-03-28 13:41:04 +00:00
|
|
|
if(!psm_is_cli()) {
|
|
|
|
die('This script can only be run from the command line.');
|
|
|
|
}
|
|
|
|
|
2014-09-11 23:08:04 +00:00
|
|
|
psm_set_cli_uri();
|
|
|
|
|
2014-02-08 20:16:41 +00:00
|
|
|
// prevent cron from running twice at the same time
|
2014-03-14 23:35:35 +00:00
|
|
|
// however if the cron has been running for X mins, we'll assume it died and run anyway
|
|
|
|
// if you want to change PSM_CRON_TIMEOUT, have a look in src/includes/psmconfig.inc.php.
|
2014-02-08 20:16:41 +00:00
|
|
|
$time = time();
|
2014-03-14 23:35:35 +00:00
|
|
|
if(psm_get_conf('cron_running') == 1 && ($time - psm_get_conf('cron_running_time') < PSM_CRON_TIMEOUT)) {
|
2014-02-08 20:16:41 +00:00
|
|
|
die('Cron is already running. Exiting.');
|
|
|
|
}
|
2014-04-15 20:05:50 +00:00
|
|
|
if(!defined('PSM_DEBUG') || !PSM_DEBUG) {
|
2014-03-16 01:04:49 +00:00
|
|
|
psm_update_conf('cron_running', 1);
|
|
|
|
}
|
2014-02-08 20:16:41 +00:00
|
|
|
psm_update_conf('cron_running_time', $time);
|
|
|
|
|
2014-08-06 11:14:41 +00:00
|
|
|
$autorun = new \psm\Util\Server\UpdateManager($db);
|
2014-03-16 01:04:49 +00:00
|
|
|
$autorun->run();
|
2014-01-07 19:24:48 +00:00
|
|
|
|
2014-02-08 20:16:41 +00:00
|
|
|
psm_update_conf('cron_running', 0);
|