Example #1
0
    private function CronTime() {
        $crons = CommonFunctions::gdc('/etc/cron.d/');
        $file = '';

        foreach($crons as $cron) {
            $path = '/etc/cron.d/'.$cron;
            if(is_file($path) && $cron == 'lcse3-monitor') {
                $file = $path;
                break;
            }
        }

        if($file == '')
            return;

        if(CommonFunctions::rfts($file, $buffer)) {
            $lines = explode("\n",$buffer);
            foreach($lines as $line) {
                if(empty($line) || $line[0] == '#' || ereg("(.*)=(.*)", $line, $assign) || $line[0] == '@')
                    continue;
                else {
                    $data = explode(" ", $line, 7);
                    break;
                }
            }

            if($data == array())
                return;

            list($minute, $heure, $jour, $mois, $jourSemaine, $user, $cmd) = $data;

            $cron = new CronParser();
            $cron->calcNextRan(implode(" ", array($minute, $heure, $jour, $mois, $jourSemaine)));
            $stamp = $cron->getLastRanUnix();

            return '<NextUpdate unix="'.$stamp.'">'.date('r',$stamp).'</NextUpdate>';
        }
    }