m_sb2 6) { $dateArr["wday"]-=7; } $months28 = Array(2); $months30 = Array(4,6,9,11); $months31 = Array(1,3,5,7,8,10,12); if ( (in_array($dateArr["mon"], $months28) && $dateArr["mday"]==28) || (in_array($dateArr["mon"], $months30) && $dateArr["mday"]==30) || (in_array($dateArr["mon"], $months31) && $dateArr["mday"]==31) ) { $dateArr["mon"]++; $dateArr["mday"] = 1; } } elseif ($unit=="hour") { if ($dateArr["hours"]==23) { incDate($dateArr, 1, "mday"); } else { $dateArr["minutes"] = 0; $dateArr["seconds"] = 0; $dateArr["hours"]++; } } elseif ($unit=="minute") { if ($dateArr["minutes"]==59) { incDate($dateArr, 1, "hour"); } else { $dateArr["seconds"] = 0; $dateArr["minutes"]++; } } if ($debug) echo sprintf("to %02d.%02d. %02d:%02d\n",$dateArr[mday],$dateArr[mon],$dateArr[hours],$dateArr[minutes]); } function getLastScheduledRunTime($job) { GLOBAL $debug; $extjob = Array(); parseElement($job[PC_MINUTE], $extjob[PC_MINUTE], 60); parseElement($job[PC_HOUR], $extjob[PC_HOUR], 24); parseElement($job[PC_DOM], $extjob[PC_DOM], 31); parseElement($job[PC_MONTH], $extjob[PC_MONTH], 12); parseElement($job[PC_DOW], $extjob[PC_DOW], 7); $dateArr = getdate(getLastActualRunTime($job[PC_CMD])); $minutesAhead = 0; while ( $minutesAhead<525600 AND (!$extjob[PC_MINUTE][$dateArr["minutes"]] OR !$extjob[PC_HOUR][$dateArr["hours"]] OR (!$extjob[PC_DOM][$dateArr["mday"]] OR !$extjob[PC_DOW][$dateArr["wday"]]) OR !$extjob[PC_MONTH][$dateArr["mon"]]) ) { if (!$extjob[PC_DOM][$dateArr["mday"]] OR !$extjob[PC_DOW][$dateArr["wday"]]) { incDate($dateArr,1,"mday"); $minutesAhead+=1440; continue; } if (!$extjob[PC_HOUR][$dateArr["hours"]]) { incDate($dateArr,1,"hour"); $minutesAhead+=60; continue; } if (!$extjob[PC_MINUTE][$dateArr["minutes"]]) { incDate($dateArr,1,"minute"); $minutesAhead++; continue; } } //if ($debug) print_r($dateArr); return mktime($dateArr["hours"],$dateArr["minutes"],0,$dateArr["mon"],$dateArr["mday"],$dateArr["year"]); } function getJobFileName($jobname) { GLOBAL $writeDir; GLOBAL $debug; $jobfile = $writeDir.urlencode($jobname).".job"; return $jobfile; } function getLastActualRunTime($jobname) { GLOBAL $debug; $jobfile = getJobFileName($jobname); if (file_exists($jobfile)) { return filemtime($jobfile); } return 0; } function markLastRun($jobname, $lastRun) { $jobfile = getJobFileName($jobname); touch($jobfile); } function runJob($job) { GLOBAL $debug, $sendLogToEmail, $resultsSummary; $resultsSummary = ""; $lastActual = $job["lSastActual"]; $lastScheduled = $job["lastScheduled"]; if ($lastScheduled"; $jobs = parseCronFile($cronTab); $jobsRun = 0; for ($i=0;$i"; ?>