fix cron.d-timing

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2014-01-14 09:31:25 +01:00
parent f4e2449822
commit 5065f5e7e4
2 changed files with 19 additions and 7 deletions

View File

@@ -41,6 +41,9 @@ function checkCrondConfigurationFile() {
SELECT * FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `isactive` = '1'
");
$hour_delay = 0;
$day_delay = 5;
$month_delay = 7;
while ($row_cronentry = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
// create cron.d-entry
if (preg_match("/(\d+) (MINUTE|HOUR|DAY|WEEK|MONTH)/", $row_cronentry['interval'], $matches)) {
@@ -49,16 +52,25 @@ function checkCrondConfigurationFile() {
$cronfile .= "*/" . $matches[1] . " * * * * ";
break;
case "HOUR":
$cronfile .= "* */" . $matches[1] . " * * * ";
$cronfile .= $hour_delay." */" . $matches[1] . " * * * ";
$hour_delay += 3;
break;
case "DAY":
$cronfile .= "* * */" . $matches[1] . " * * ";
break;
case "WEEK":
$cronfile .= "* * * */" . $matches[1] . " * ";
$cronfile .= $day_delay." 0 */" . $matches[1] . " * * ";
$day_delay += 5;
break;
case "MONTH":
$cronfile .= "* * * * */" . $matches[1] . " ";
if ($row_cronentry['cronfile'] == 'traffic') {
// traffic at exactly 0:00 o'clock
$cronfile .= "0 0 0 */" . $matches[1] . " * ";
} else {
$cronfile .= $month_delay." 0 0 */" . $matches[1] . " * ";
$month_delay += 7;
}
break;
case "WEEK":
$cronfile .= $day_delay." 0 " . ($matches[1] * 7) . " * * ";
$day_delay += 5;
break;
}

View File

@@ -1525,6 +1525,6 @@ $lng['serversettings']['mtalog']['description'] = "Die Logdatei des Mail Transfe
$lng['panel']['ftpdesc'] = 'FTP Beschreibung';
$lng['admin']['cronsettings'] = 'Cronjob Einstellungen';
$lng['serversettings']['system_cronconfig']['title'] = 'Cron-Konfigurationsdatei';
$lng['serversettings']['system_cronconfig']['description'] = 'Pfad zur Konfigurationsdatei des Cron-Dienstes. Diese Datei wird von froxlor automatisch aktualisiert.<br />Hinweis: bitte <b>nicht</b> die gleiche Datei wie für den Froxlor-Hautp-Cronjob angeben (/etc/cron.d/froxlor)!';
$lng['serversettings']['system_cronconfig']['description'] = 'Pfad zur Konfigurationsdatei des Cron-Dienstes. Diese Datei wird von froxlor automatisch aktualisiert.<br />Hinweis: bitte <b>nicht</b> die gleiche Datei wie für den Froxlor-Haupt-Cronjob angeben (/etc/cron.d/froxlor)!';
$lng['tasks']['remove_ftpacc_files'] = 'Kunden FTP-Konto Dateien löschen';
$lng['tasks']['regenerating_crond'] = 'Neuerstellung der cron.d-Datei';