diff --git a/lib/functions/froxlor/function.checkCrondConfigurationFile.php b/lib/functions/froxlor/function.checkCrondConfigurationFile.php index 70b02a07..fe0c081d 100644 --- a/lib/functions/froxlor/function.checkCrondConfigurationFile.php +++ b/lib/functions/froxlor/function.checkCrondConfigurationFile.php @@ -32,9 +32,14 @@ function checkCrondConfigurationFile() { if ($num_results > 0) { // get all crons and their intervals - $cronfile = "# automatically generated cron-configuration by froxlor\n"; - $cronfile.= "# do not manually edit this file as it will be re-generated periodically.\n"; - $cronfile.= "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin\n#\n"; + if (isFreeBSD()) { + // FreeBSD does not need a header as we are writing directly to the crontab + $cronfile = "\n"; + } else { + $cronfile = "# automatically generated cron-configuration by froxlor\n"; + $cronfile.= "# do not manually edit this file as it will be re-generated periodically.\n"; + $cronfile.= "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin\n#\n"; + } // get all the crons $result_stmt = Database::query(" @@ -90,10 +95,37 @@ function checkCrondConfigurationFile() { } } + if (isFreeBSD()) { + // FreeBSD handles the cron-stuff in another way. We need to directly + // write to the crontab file as there is not cron.d/froxlor file + // (settings for system.cronconfig should be set correctly of course) + $crontab = file_get_contents(Settings::Get("system.cronconfig")); + + if ($crontab === false) { + die("Oh snap, we cannot read the crontab file. This should not happen.\nPlease check the path and permissions, the cron will keep trying if you don't stop the cron-service.\n\n"); + } + + // now parse out / replace our entries + $crontablines = explode("\n", $crontab); + $newcrontab = ""; + foreach ($crontablines as $ctl) { + $ctl = trim($ctl); + if (!empty($ctl) && !preg_match("/(.*)froxlor_master_cronjob\.php(.*)/", $ctl)) { + $newcrontab .= $ctl."\n"; + } + } + + // re-assemble old-content + new froxlor-content + $newcrontab .= $cronfile; + + // now continue with writing the file + $cronfile = $newcrontab; + } + // write the file if (file_put_contents(Settings::Get("system.cronconfig"), $cronfile) === false) { // oh snap cannot create new crond-file - die("Oh snap, we cannot create the cron.d file. This should not happen.\nPlease check the path and permissions, the cron will keep trying if you don't stop the cron-service.\n\n"); + die("Oh snap, we cannot create the cron-file. This should not happen.\nPlease check the path and permissions, the cron will keep trying if you don't stop the cron-service.\n\n"); } // correct permissions chmod(Settings::Get("system.cronconfig"), 0640); diff --git a/lng/english.lng.php b/lng/english.lng.php index 268fa234..6cfd57f8 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1800,7 +1800,7 @@ $lng['serversettings']['mtalog']['description'] = "Logfile of the Mail Transfer $lng['panel']['ftpdesc'] = 'FTP description'; $lng['admin']['cronsettings'] = 'Cronjob settings'; $lng['serversettings']['system_cronconfig']['title'] = 'Cron configuration file'; -$lng['serversettings']['system_cronconfig']['description'] = 'Path to the cron-service configuration-file. This file will be updated regularly and automatically by froxlor.
Note: Please be sure to use the same filename as for the main froxlor cronjob (default: /etc/cron.d/froxlor)!'; +$lng['serversettings']['system_cronconfig']['description'] = 'Path to the cron-service configuration-file. This file will be updated regularly and automatically by froxlor.
Note: Please be sure to use the same filename as for the main froxlor cronjob (default: /etc/cron.d/froxlor)!

If you are using FreeBSD, please specify /etc/crontab here!'; $lng['tasks']['remove_ftpacc_files'] = 'Delete customer ftp-account data.'; $lng['tasks']['regenerating_crond'] = 'Rebuilding the cron.d-file'; $lng['serversettings']['system_crondreload']['title'] = 'Cron-daemon reload command'; diff --git a/lng/german.lng.php b/lng/german.lng.php index 9684fde2..058a85c8 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1524,7 +1524,7 @@ $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.
Hinweis: Bitte verwenden Sie exakt die gleiche Datei wie für den Froxlor-Haupt-Cronjob (Standard: /etc/cron.d/froxlor)!'; +$lng['serversettings']['system_cronconfig']['description'] = 'Pfad zur Konfigurationsdatei des Cron-Dienstes. Diese Datei wird von Froxlor automatisch aktualisiert.
Hinweis: Bitte verwenden Sie exakt die gleiche Datei wie für den Froxlor-Haupt-Cronjob (Standard: /etc/cron.d/froxlor)!

Wird FreeBSD verwendet, sollte hier /etc/crontab angegeben werden!'; $lng['tasks']['remove_ftpacc_files'] = 'Kunden FTP-Konto Dateien löschen'; $lng['tasks']['regenerating_crond'] = 'Neuerstellung der cron.d-Datei'; $lng['serversettings']['system_crondreload']['title'] = 'Cron-Daemon reload Befehl';