remove build-in logrotate feature and provide logrotate-script
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'logrotate' => array(
|
||||
'title' => $lng['logrotate'],
|
||||
'fields' => array(
|
||||
'logrotate_enabled' => array(
|
||||
'label' => $lng['logrotate_enabled'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'logrotate_enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => true
|
||||
),
|
||||
'logrotate_binary' => array(
|
||||
'label' => $lng['logrotate_binary'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'logrotate_binary',
|
||||
'type' => 'string',
|
||||
'default' => '/usr/sbin/logrotate',
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => false
|
||||
),
|
||||
'logrotate_interval' => array(
|
||||
'label' => $lng['logrotate_interval'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'logrotate_interval',
|
||||
'type' => 'option',
|
||||
'default' => 'weekly',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array('daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly'),
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => false
|
||||
),
|
||||
'logrotate_keep' => array(
|
||||
'label' => $lng['logrotate_keep'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'logrotate_keep',
|
||||
'type' => 'string',
|
||||
'default' => '4',
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => false
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -98,7 +98,9 @@ if($userinfo['change_serversettings'] == '1')
|
||||
'<SSLPROTOCOLS>' => ($settings['system']['use_ssl'] == '1') ? 'imaps pop3s' : '',
|
||||
'<CUSTOMER_TMP>' => ($settings['system']['mod_fcgid_tmpdir'] != '') ? makeCorrectDir($settings['system']['mod_fcgid_tmpdir']) : '/tmp/',
|
||||
'<BASE_PATH>' => makeCorrectDir(dirname(__FILE__)),
|
||||
'<BIND_CONFIG_PATH>' => makeCorrectDir($settings['system']['bindconf_directory'])
|
||||
'<BIND_CONFIG_PATH>' => makeCorrectDir($settings['system']['bindconf_directory']),
|
||||
'<WEBSERVER_RELOAD_CMD>' => $settings['system']['apachereload_command'],
|
||||
'<CUSTOMER_LOGS>' => makeCorrectDir($settings['system']['logfiles_directory'])
|
||||
);
|
||||
$files = '';
|
||||
$configpage = '';
|
||||
|
||||
@@ -2219,3 +2219,17 @@ if (isFroxlorVersion('0.9.29.1-dev1')) {
|
||||
|
||||
updateToVersion('0.9.29.1-dev2');
|
||||
}
|
||||
|
||||
if (isFroxlorVersion('0.9.29.1-dev2')) {
|
||||
showUpdateStep("Updating from 0.9.29.1-dev2 to 0.9.29.1-dev3", true);
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Removing old logrotate settings");
|
||||
$db->query("DELETE FROM `panel_settings` WHERE `varname` = 'logrotate_enabled';");
|
||||
$db->query("DELETE FROM `panel_settings` WHERE `varname` = 'logrotate_binary';");
|
||||
$db->query("DELETE FROM `panel_settings` WHERE `varname` = 'logrotate_interval';");
|
||||
$db->query("DELETE FROM `panel_settings` WHERE `varname` = 'logrotate_keep';");
|
||||
lastStepStatus(0);
|
||||
|
||||
updateToVersion('0.9.29.1-dev3');
|
||||
}
|
||||
|
||||
@@ -541,4 +541,11 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
|
||||
$question.= '<input type="text" class="text" name="system_customersslpath" value="/etc/apache2/ssl/" />';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
|
||||
if (versionInUpdate($current_version, '0.9.29.1-dev3')) {
|
||||
$has_preconfig = true;
|
||||
$description = 'The build in logrotation-feature has been removed. Please follow the configuration-instructions for your system to enable logrotating again.';
|
||||
$question = '';
|
||||
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,6 +384,22 @@ return Array(
|
||||
'restart' => Array(
|
||||
'sh /etc/rc.d/nscd restart'
|
||||
)
|
||||
),
|
||||
'logrotate' => array(
|
||||
'label' => 'Logrotate',
|
||||
'commands_1' => array(
|
||||
'cd /usr/ports/sysutils/logrotate/',
|
||||
'make install clean clean-depends',
|
||||
'touch /etc/logrotate.d/froxlor',
|
||||
'chmod 644 /etc/logrotate.d/froxlor'
|
||||
),
|
||||
'files' => array(
|
||||
'etc_logrotated_froxlor' => '/etc/logrotate.d/froxlor'
|
||||
),
|
||||
'commands_2' => array(
|
||||
'# create cronjob-entry (daily-recommended)',
|
||||
'0 2 * * * /usr/local/sbin/logrotate -f /etc/logrotate.d/froxlor'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -416,6 +416,21 @@ milter_default_action = accept" >> /etc/postfix/main.cf',
|
||||
'restart' => Array(
|
||||
'/etc/init.d/nscd restart'
|
||||
)
|
||||
),
|
||||
'logrotate' => array(
|
||||
'label' => 'Logrotate',
|
||||
'commands_1' => array(
|
||||
'emerge -av app-admin/logrotate',
|
||||
'touch /etc/logrotate.d/froxlor',
|
||||
'chmod 644 /etc/logrotate.d/froxlor'
|
||||
),
|
||||
'files' => array(
|
||||
'etc_logrotated_froxlor' => '/etc/logrotate.d/froxlor'
|
||||
),
|
||||
'commands_2' => array(
|
||||
'# emerge automatically adds a daily cronjob for logrotate',
|
||||
'# you do not have to do anything else :)'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -395,6 +395,21 @@ return Array(
|
||||
'restart' => Array(
|
||||
'/etc/init.d/nscd restart'
|
||||
)
|
||||
),
|
||||
'logrotate' => array(
|
||||
'label' => 'Logrotate',
|
||||
'commands_1' => array(
|
||||
'apt-get install logrotate',
|
||||
'touch /etc/logrotate.d/froxlor',
|
||||
'chmod 644 /etc/logrotate.d/froxlor'
|
||||
),
|
||||
'files' => array(
|
||||
'etc_logrotated_froxlor' => '/etc/logrotate.d/froxlor'
|
||||
),
|
||||
'commands_2' => array(
|
||||
'# apt automatically adds a daily cronjob for logrotate',
|
||||
'# you do not have to do anything else :)'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -397,6 +397,21 @@ return Array(
|
||||
'restart' => Array(
|
||||
'/etc/init.d/nscd restart'
|
||||
)
|
||||
),
|
||||
'logrotate' => array(
|
||||
'label' => 'Logrotate',
|
||||
'commands_1' => array(
|
||||
'apt-get install logrotate',
|
||||
'touch /etc/logrotate.d/froxlor',
|
||||
'chmod 644 /etc/logrotate.d/froxlor'
|
||||
),
|
||||
'files' => array(
|
||||
'etc_logrotated_froxlor' => '/etc/logrotate.d/froxlor'
|
||||
),
|
||||
'commands_2' => array(
|
||||
'# apt automatically adds a daily cronjob for logrotate',
|
||||
'# you do not have to do anything else :)'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -394,6 +394,21 @@ return Array(
|
||||
'restart' => Array(
|
||||
'/etc/init.d/nscd restart'
|
||||
)
|
||||
),
|
||||
'logrotate' => array(
|
||||
'label' => 'Logrotate',
|
||||
'commands_1' => array(
|
||||
'apt-get install logrotate',
|
||||
'touch /etc/logrotate.d/froxlor',
|
||||
'chmod 644 /etc/logrotate.d/froxlor'
|
||||
),
|
||||
'files' => array(
|
||||
'etc_logrotated_froxlor' => '/etc/logrotate.d/froxlor'
|
||||
),
|
||||
'commands_2' => array(
|
||||
'# apt automatically adds a daily cronjob for logrotate',
|
||||
'# you do not have to do anything else :)'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -398,6 +398,21 @@ return Array(
|
||||
'/etc/init.d/nscd restart'
|
||||
)
|
||||
),
|
||||
'logrotate' => array(
|
||||
'label' => 'Logrotate',
|
||||
'commands_1' => array(
|
||||
'apt-get install logrotate',
|
||||
'touch /etc/logrotate.d/froxlor',
|
||||
'chmod 644 /etc/logrotate.d/froxlor'
|
||||
),
|
||||
'files' => array(
|
||||
'etc_logrotated_froxlor' => '/etc/logrotate.d/froxlor'
|
||||
),
|
||||
'commands_2' => array(
|
||||
'# apt automatically adds a daily cronjob for logrotate',
|
||||
'# you do not have to do anything else :)'
|
||||
)
|
||||
),
|
||||
'fcgid' => array(
|
||||
'label' => 'FCGID',
|
||||
'commands' => array(
|
||||
|
||||
@@ -74,6 +74,6 @@ define('PACKAGE_LOCKED', 1);
|
||||
define('PACKAGE_ENABLED', 2);
|
||||
|
||||
// VERSION INFO
|
||||
$version = '0.9.29.1-dev2';
|
||||
$version = '0.9.29.1-dev3';
|
||||
$dbversion = '2';
|
||||
$branding = '';
|
||||
|
||||
@@ -1874,11 +1874,6 @@ $lng['error']['session_timeout'] = 'Value too low';
|
||||
$lng['error']['session_timeout_desc'] = 'You should not set the session timeout lower than 1 minute.';
|
||||
|
||||
// ADDED IN FROXLOR 0.9.24-svn1
|
||||
$lng['logrotate'] = 'Logrotate';
|
||||
$lng['logrotate_enabled'] = 'Enable logrotate?';
|
||||
$lng['logrotate_binary'] = 'Path to logrotate binary:';
|
||||
$lng['logrotate_interval'] = 'Interval?';
|
||||
$lng['logrotate_keep'] = 'How many logfiles should be kept?';
|
||||
$lng['admin']['assignedmax'] = 'Assigned / Max';
|
||||
$lng['admin']['usedmax'] = 'Used / Max';
|
||||
$lng['admin']['used'] = 'Used';
|
||||
|
||||
@@ -1600,11 +1600,6 @@ $lng['error']['session_timeout'] = 'Wert zu niedrig';
|
||||
$lng['error']['session_timeout_desc'] = 'Der Wert der Session-Timeout sollte nicht unter einer Minute liegen.';
|
||||
|
||||
// ADDED IN FROXLOR 0.9.24-svn1
|
||||
$lng['logrotate'] = 'Logrotate';
|
||||
$lng['logrotate_enabled'] = 'Logrotate aktivieren?';
|
||||
$lng['logrotate_binary'] = 'Pfad zum logrotate-binary?';
|
||||
$lng['logrotate_interval'] = 'Intervall?';
|
||||
$lng['logrotate_keep'] = 'Wie viele Logdateien sollen aufbewahrt werden?';
|
||||
$lng['admin']['assignedmax'] = 'Zugewiesen / Max.';
|
||||
$lng['admin']['usedmax'] = 'Benutzt / Max.';
|
||||
$lng['admin']['used'] = 'Benutzt';
|
||||
|
||||
@@ -477,11 +477,6 @@ $lng['traffic']['sumftp'] = 'FTP流量合计 - ';
|
||||
$lng['traffic']['summail'] = '邮件流量合计 - ';
|
||||
|
||||
// ADDED IN FROXLOR 0.9.24-svn1
|
||||
$lng['logrotate'] = '转储';
|
||||
$lng['logrotate_enabled'] = '开启转储?';
|
||||
$lng['logrotate_binary'] = '转储(Logrotate)二进制路径:';
|
||||
$lng['logrotate_interval'] = '间隔?';
|
||||
$lng['logrotate_keep'] = '保留多少日志文件?';
|
||||
$lng['admin']['assignedmax'] = '已指派 / 上限';
|
||||
$lng['admin']['usedmax'] = '已用 / 上限';
|
||||
$lng['admin']['used'] = '已用';
|
||||
|
||||
@@ -81,7 +81,7 @@ fwrite($debugHandler, 'Traffic run started...' . "\n");
|
||||
$admin_traffic = array();
|
||||
$domainlist = array();
|
||||
$speciallogfile_domainlist = array();
|
||||
$result_domainlist = $db->query("SELECT `id`, `domain`, `customerid`, `parentdomainid`, `speciallogfile` FROM `" . TABLE_PANEL_DOMAINS . "` ;");
|
||||
$result_domainlist = $db->query("SELECT `id`, `domain`, `customerid`, `parentdomainid`, `speciallogfile` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `aliasdomain` IS NULL AND `email_only` <> '1' ;");
|
||||
|
||||
while($row_domainlist = $db->fetch_array($result_domainlist))
|
||||
{
|
||||
@@ -206,39 +206,6 @@ while ($row = $db->fetch_array($result)) {
|
||||
}
|
||||
}
|
||||
|
||||
// logrotate speciallogfiles
|
||||
if (isset($speciallogfile_domainlist[$row['customerid']])
|
||||
&& is_array($speciallogfile_domainlist[$row['customerid']])
|
||||
&& count($speciallogfile_domainlist[$row['customerid']]) != 0
|
||||
) {
|
||||
reset($speciallogfile_domainlist[$row['customerid']]);
|
||||
foreach ($speciallogfile_domainlist[$row['customerid']] as $domainid => $domain) {
|
||||
|
||||
$logrotatefile = '/tmp/froxlor_logrotate_tmpfile.conf';
|
||||
$fh = fopen($logrotatefile, 'w');
|
||||
|
||||
$logconf = '# ' . basename($logrotatefile) . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" .
|
||||
$settings['system']['logfiles_directory'] . $row['loginname'] .'-' . $domain . '-access.log ' .
|
||||
$settings['system']['logfiles_directory'] . $row['loginname'] .'-' . $domain . '-error.log {' . "\n" .
|
||||
$settings['system']['logrotate_interval'] . "\n" .
|
||||
'missingok' . "\n" .
|
||||
'rotate ' . $settings['system']['logrotate_keep'] . "\n" .
|
||||
'compress' . "\n" .
|
||||
'delaycompress' . "\n" .
|
||||
'notifempty' . "\n" .
|
||||
'create' . "\n" .
|
||||
'}' . "\n";
|
||||
|
||||
fwrite($fh, $logconf);
|
||||
fclose($fh);
|
||||
|
||||
safe_exec(escapeshellcmd($settings['system']['logrotate_binary']) . ' ' . $logrotatefile);
|
||||
|
||||
fwrite($debugHandler, ' apache::reload: reloading apache' . "\n");
|
||||
safe_exec(escapeshellcmd($settings['system']['apachereload_command']));
|
||||
}
|
||||
}
|
||||
|
||||
reset($domainlist[$row['customerid']]);
|
||||
|
||||
// callAwstatsGetTraffic is called ONLY HERE and
|
||||
@@ -254,34 +221,6 @@ while ($row = $db->fetch_array($result)) {
|
||||
// make the stuff readable for the customer, #258
|
||||
makeChownWithNewStats($row);
|
||||
|
||||
// logrotate
|
||||
if ($settings['system']['logrotate_enabled'] == '1') {
|
||||
fwrite($debugHandler, ' logrotate customers logs' . "\n");
|
||||
|
||||
$logrotatefile = '/tmp/froxlor_logrotate_tmpfile.conf';
|
||||
$fh = fopen($logrotatefile, 'w');
|
||||
|
||||
$logconf = '# ' . basename($logrotatefile) . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" .
|
||||
$settings['system']['logfiles_directory'] . $row['loginname'] . '-access.log ' .
|
||||
$settings['system']['logfiles_directory'] . $row['loginname'] . '-error.log {' . "\n" .
|
||||
$settings['system']['logrotate_interval'] . "\n" .
|
||||
'missingok' . "\n" .
|
||||
'rotate ' . $settings['system']['logrotate_keep'] . "\n" .
|
||||
'compress' . "\n" .
|
||||
'delaycompress' . "\n" .
|
||||
'notifempty' . "\n" .
|
||||
'create' . "\n" .
|
||||
'}' . "\n";
|
||||
|
||||
fwrite($fh, $logconf);
|
||||
fclose($fh);
|
||||
|
||||
safe_exec(escapeshellcmd($settings['system']['logrotate_binary']) . ' ' . $logrotatefile);
|
||||
|
||||
fwrite($debugHandler, ' apache::reload: reloading apache' . "\n");
|
||||
safe_exec(escapeshellcmd($settings['system']['apachereload_command']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Webalizer/AWStats might run for some time, so we'd better check if our database is still present
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Froxlor logrotate snipet
|
||||
#
|
||||
<CUSTOMER_LOGS>*.log {
|
||||
missingok
|
||||
weekly
|
||||
rotate 4
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
create
|
||||
sharedscripts
|
||||
postrotate
|
||||
<WEBSERVER_RELOAD_CMD> > /dev/null 2>&1 || true
|
||||
endscript
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Froxlor logrotate snipet
|
||||
#
|
||||
<CUSTOMER_LOGS>*.log {
|
||||
missingok
|
||||
weekly
|
||||
rotate 4
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
create
|
||||
sharedscripts
|
||||
postrotate
|
||||
<WEBSERVER_RELOAD_CMD> > /dev/null 2>&1 || true
|
||||
endscript
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Froxlor logrotate snipet
|
||||
#
|
||||
<CUSTOMER_LOGS>*.log {
|
||||
missingok
|
||||
weekly
|
||||
rotate 4
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
create
|
||||
sharedscripts
|
||||
postrotate
|
||||
<WEBSERVER_RELOAD_CMD> > /dev/null 2>&1 || true
|
||||
endscript
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Froxlor logrotate snipet
|
||||
#
|
||||
<CUSTOMER_LOGS>*.log {
|
||||
missingok
|
||||
weekly
|
||||
rotate 4
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
create
|
||||
sharedscripts
|
||||
postrotate
|
||||
<WEBSERVER_RELOAD_CMD> > /dev/null 2>&1 || true
|
||||
endscript
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Froxlor logrotate snipet
|
||||
#
|
||||
<CUSTOMER_LOGS>*.log {
|
||||
missingok
|
||||
weekly
|
||||
rotate 4
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
create
|
||||
sharedscripts
|
||||
postrotate
|
||||
<WEBSERVER_RELOAD_CMD> > /dev/null 2>&1 || true
|
||||
endscript
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Froxlor logrotate snipet
|
||||
#
|
||||
<CUSTOMER_LOGS>*.log {
|
||||
missingok
|
||||
weekly
|
||||
rotate 4
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
create
|
||||
sharedscripts
|
||||
postrotate
|
||||
<WEBSERVER_RELOAD_CMD> > /dev/null 2>&1 || true
|
||||
endscript
|
||||
}
|
||||
Reference in New Issue
Block a user