Skip to content
Snippets Groups Projects
Select Git revision
  • 47c1cc394b44cee6600ce8246cee664016fa62bd
  • master default protected
  • update-renderer-class
3 results

cronlog.class.php

Blame
  • cronlog.class.php 11.51 KiB
    <?php
    /**
     * ______________________________________________________________________
     * 
     *  _____                 _       _             _                        
     * /  __ \               (_)     | |           (_)                       
     * | /  \/_ __ ___  _ __  _  ___ | |__   __   ___  _____      _____ _ __ 
     * | |   | '__/ _ \| '_ \| |/ _ \| '_ \  \ \ / / |/ _ \ \ /\ / / _ \ '__|
     * | \__/\ | | (_) | | | | | (_) | |_) |  \ V /| |  __/\ V  V /  __/ |   
     *  \____/_|  \___/|_| |_| |\___/|_.__/    \_/ |_|\___| \_/\_/ \___|_|   
     *                      _/ |                                             
     *                     |__/                                              
     * ______________________________________________________________________
     * 
     * The cronjob viewer for centralized monitoring of cronjobs using
     * Axels cronrwapper (see <https://github.com/axelhahn/cronwrapper>).
     * 
     * You can browse all servers to see 
     * - the last status of all cronjobs
     * - results an execution times of running jonbs
     * - a timeline for all jobs running > 60s
     * 
     * 
     * Free software. Open Source. GNU GPL 3.
     * SOURCE: <https://git-repo.iml.unibe.ch/iml-open-source/cronlog-viewer>
     * 
     * ______________________________________________________________________
     * 
     * The cronlog class contains non visual methods
     * @see cronlog-renderer.class.php
     *
     * @license GNU GPL 3.0
     * @author Axel Hahn <axel.hahn@iml.unibe.ch>
     */
    
    class cronlog {
        
        
        protected $_sDataDir = "__APPDIR__/data";
        protected $_iTtlCache = 60; // in sec
    
        /**
         * when show an error for expired jobs (latency to execute job and sync logs)
         * @var integer
         */
        protected $_iExpiredJobsFailAfter = 60*30; // in sec
        protected $_iMinTtl = 0; // in sec
        protected $_aSkipJoblogs = array();
        
        protected $_aServers = array();
        protected $_sActiveServer = false;
        
        protected $_sFileFilter_serverjoblog = '*joblog*.done';
        protected $_sFileFilter_serverlog = '*.log';
    
        // ----------------------------------------------------------------------
        // MAIN
        // ----------------------------------------------------------------------
    
        /**
         * init
         * @return boolean
         */
        public function __construct() {
    
            // read config
            if (file_exists(__DIR__.'/../config/inc_cronlog.php')){
                $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;