introducing new way of controling the cronjobs by creating a cron.d-file

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2014-01-13 08:55:39 +01:00
parent c5efe9fd7f
commit 4be52f76eb
14 changed files with 232 additions and 141 deletions

View File

@@ -499,6 +499,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'mdaserver', 'dovecot'),
('system', 'mtaserver', 'postfix'),
('system', 'mailtraffic_enabled', '1'),
('system', 'cronconfig', '/etc/cron.d/froxlor'),
('panel', 'decimal_places', '4'),
('panel', 'adminmail', 'admin@SERVERNAME'),
('panel', 'phpmyadmin_url', ''),
@@ -526,7 +527,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('panel', 'phpconfigs_hidestdsubdomain', '0'),
('panel', 'allow_theme_change_admin', '1'),
('panel', 'allow_theme_change_customer', '1'),
('panel', 'version', '0.9.32-dev4');
('panel', 'version', '0.9.32-dev5');
DROP TABLE IF EXISTS `panel_tasks`;
@@ -737,12 +738,12 @@ CREATE TABLE IF NOT EXISTS `cronjobs_run` (
INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES
(1, 'froxlor/core', 'cron_tasks.php', '5 MINUTE', '1', 'cron_tasks'),
(2, 'froxlor/core', 'cron_traffic.php', '1 DAY', '1', 'cron_traffic'),
(3, 'froxlor/ticket', 'cron_used_tickets_reset.php', '1 DAY', '1', 'cron_ticketsreset'),
(4, 'froxlor/ticket', 'cron_ticketarchive.php', '1 MONTH', '1', 'cron_ticketarchive'),
(5, 'froxlor/reports', 'cron_usage_report.php', '1 DAY', '1', 'cron_usage_report'),
(6, 'froxlor/core', 'cron_mailboxsize.php', '6 HOUR', '1', 'cron_mailboxsize');
(1, 'froxlor/core', 'tasks', '5 MINUTE', '1', 'cron_tasks'),
(2, 'froxlor/core', 'traffic', '1 DAY', '1', 'cron_traffic'),
(3, 'froxlor/ticket', 'used_tickets_reset', '1 DAY', '1', 'cron_ticketsreset'),
(4, 'froxlor/ticket', 'ticketarchive', '1 MONTH', '1', 'cron_ticketarchive'),
(5, 'froxlor/reports', 'usage_report', '1 DAY', '1', 'cron_usage_report'),
(6, 'froxlor/core', 'mailboxsize', '6 HOUR', '1', 'cron_mailboxsize');

View File

@@ -2430,9 +2430,9 @@ if (isFroxlorVersion('0.9.31-dev1')) {
INSERT INTO `".TABLE_PANEL_SETTINGS."` SET `settinggroup` = 'phpfpm', `varname` = 'fastcgi_ipcdir', `value` = :value
");
$params = array();
if (Settings::Get('system.webserver') == 'apache2') {
$params['value'] = '/var/lib/apache2/fastcgi/';
} elseif (Settings::Get('system.webserver') == 'lighttpd') {
// set default for apache (which will suite in most cases)
$params['value'] = '/var/lib/apache2/fastcgi/';
if (Settings::Get('system.webserver') == 'lighttpd') {
$params['value'] = '/var/run/lighttpd/';
} elseif (Settings::Get('system.webserver') == 'nginx') {
$params['value'] = '/var/run/nginx/';
@@ -2680,3 +2680,24 @@ if (isFroxlorVersion('0.9.32-dev3')) {
updateToVersion('0.9.32-dev4');
}
if (isFroxlorVersion('0.9.32-dev4')) {
showUpdateStep("Updating from 0.9.32-dev4 to 0.9.32-dev5");
lastStepStatus(0);
showUpdateStep("Updating cronjob table");
Database::query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `cronfile` = REPLACE( REPLACE(`cronfile`, 'cron_', ''), '.php', '')");
lastStepStatus(0);
showUpdateStep("Adding new settings for cron");
// get user-chosen value
$crondfile = isset($_POST['crondfile']) ? $_POST['crondfile'] : "/etc/cron.d/froxlor";
$crondfile = makeCorrectFile($crondfile);
Settings::AddNew("system.cronconfig", $crondfile);
// add task to generate cron.d-file
inserttask('99');
lastStepStatus(0);
updateToVersion('0.9.32-dev5');
}

View File

@@ -634,4 +634,11 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) {
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
if (versionInUpdate($current_version, '0.9.32-dev5')) {
$has_preconfig = true;
$description = 'Froxlor now generates a cron-configuration file for the cron-daemon. Please set a filename which will be included automatically by your crond (e.g. files in /etc/cron.d/)<br /><br />';
$question = '<strong>Path to the cron-service configuration-file.</strong> This file will be updated regularly and automatically by froxlor.<br />';
$question.= '<input type="text" class="text" name="crondfile" value="/etc/cron.d/froxlor" /><br />';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}