diff --git a/classes/cronlog-renderer.class.php b/classes/cronlog-renderer.class.php index 5fab6ca92fb2104d292b7f1be3c48c9e914f93c3..81ad1cb2759d14b42e47f6e17a6ebc356ac45d5a 100644 --- a/classes/cronlog-renderer.class.php +++ b/classes/cronlog-renderer.class.php @@ -91,9 +91,13 @@ class cronlogrenderer extends cronlog{ $iLast=max(array($iLast, date("U", $aEntry['SCRIPTSTARTTIME']))); $aErrors=array(); + $iTtlUsed=min($aEntry['SCRIPTTTL'], $this->_iMinTtl); $iNextRun=$aEntry['SCRIPTSTARTTIME']+((int)$aEntry['SCRIPTTTL']*60); - if($iNextRun < date("U")-$this->_iExpiredJobsFailAfter){ + $iNextRunWarn=$aEntry['SCRIPTSTARTTIME']+((int)$iTtlUsed*60); + $iNextRunErr=$aEntry['SCRIPTSTARTTIME']+((int)$this->_iExpiredJobsFailAfter*60); + + if($iNextRunErr < date("U")){ $aErrors[]='outdated'; } if($aEntry['SCRIPTRC']>0){ @@ -123,12 +127,16 @@ class cronlogrenderer extends cronlog{ .(int)$aEntry['SCRIPTEXECTIME'].'s' .((int)$aEntry['SCRIPTEXECTIME']>100 ? ' ('.round((int)$aEntry['SCRIPTEXECTIME']/60).'min)' : '') .'</td>' - . '<td>'.$aEntry['SCRIPTTTL'].'</td>' + . '<td' + .($aEntry['SCRIPTTTL']<$this->_iMinTtl ? ' class="message-warning" title="(using minimal TTL = '.$this->_iMinTtl.' min)"' : '') + . '>' + .$aEntry['SCRIPTTTL'] + .'</td>' . '<td class="'.($aEntry['SCRIPTRC']>0 ? 'message-error' : 'message-ok' ).'">' .$aEntry['SCRIPTRC'] .'</td>' - . '<td class="'.($iNextRun < date("U") - ? ($iNextRun < date("U") - $this->_iExpiredJobsFailAfter ? 'message-error' : 'message-warning') + . '<td class="'.($iNextRunWarn < date("U") + ? ($iNextRunErr < date("U") ? 'message-error' : 'message-warning') : '' ).'">' . date("Y-m-d H:i", $iNextRun).'</td>' . '<td class="'.(count($aErrors) ? 'message-error' : '' ).'">' diff --git a/classes/cronlog.class.php b/classes/cronlog.class.php index d700bdf6346e433604c83fabf1e9004236957ba9..2ab134fd57156658e884fa9f471686add9fbe185 100644 --- a/classes/cronlog.class.php +++ b/classes/cronlog.class.php @@ -44,6 +44,7 @@ class cronlog { * @var integer */ protected $_iExpiredJobsFailAfter = 60*30; // in sec + protected $_iMinTtl = 0; // in sec protected $_aSkipJoblogs = array(); protected $_aServers = array(); @@ -67,6 +68,7 @@ class cronlog { $aCfgTemp=include(__DIR__.'/../config/inc_cronlog.php'); $this->_sDataDir = isset($aCfgTemp['sDatadir']) ? $aCfgTemp['sDatadir'] : $this->_sDataDir; $this->_iTtlCache = isset($aCfgTemp['iTtlCache']) ? (int)$aCfgTemp['iTtlCache'] : $this->_iTtlCache; + $this->_iMinTtl = isset($aCfgTemp['iMinTtl']) ? (int)$aCfgTemp['iMinTtl'] : $this->_iMinTtl; $this->_iExpiredJobsFailAfter = isset($aCfgTemp['iExpiredJobsFailAfter']) ? (int)$aCfgTemp['iExpiredJobsFailAfter'] : $this->_iExpiredJobsFailAfter; $this->_aSkipJoblogs = isset($aCfgTemp['aHidelogs']) && is_array($aCfgTemp['aHidelogs']) ? $aCfgTemp['aHidelogs'] : $this->_aSkipJoblogs; } diff --git a/config/inc_cronlog.php.dist b/config/inc_cronlog.php.dist index 37c407c7e6385a0b375c1fb499f38189a4d11baa..2d9be227f03f403b74770be8fe70ef0156317119 100644 --- a/config/inc_cronlog.php.dist +++ b/config/inc_cronlog.php.dist @@ -23,8 +23,12 @@ return array( // caching time for serverinfos 'iTtlCache'=>60, - // when show an error for expired jobs (latency to execute job and sync logs) - 'iExpiredJobsFailAfter'=>60*30, + // set minmal TTL (cronjobs with lower TTL will usethat limit) [min] + // minimum is cycle how often the log sync is running + 'iMinTtl'=>10, + + // when show an error for expired jobs (latency to execute job and sync logs) [min] + 'iExpiredJobsFailAfter'=>30, // hide these cronjob labels in the web gui tab "history" 'aHidelogs'=>array(