From b6b4a4b0e787e11aab98d2b9e7396f6aa1ac7c00 Mon Sep 17 00:00:00 2001 From: Danny Terweij Date: Sat, 22 Feb 2014 20:10:45 +0100 Subject: [PATCH] Project issue #295. - Add kloxo log rotate (saves HDD space on a lot Kloxo installations!) --- kloxo/file/kloxo.logrotate | 71 ++++++++++++++++++++++++++++++ kloxo/httpdocs/htmllib/lib/lib.php | 18 ++++---- 2 files changed, 79 insertions(+), 10 deletions(-) create mode 100644 kloxo/file/kloxo.logrotate diff --git a/kloxo/file/kloxo.logrotate b/kloxo/file/kloxo.logrotate new file mode 100644 index 0000000000..2701b2a862 --- /dev/null +++ b/kloxo/file/kloxo.logrotate @@ -0,0 +1,71 @@ +# Kloxo, Hosting Control Panel +# +# Copyright (C) 2000-2009 LxLabs +# Copyright (C) 2009-2014 LxCenter +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# Kloxo LogRotate +# Initial version +# Needs cleanup +# Using this one on LxCenter server +# Created by Danny Terweij +# +# Defaults to weekly rotates (compressed) and keeps maximum of 8 weeks + +/var/log/kloxo/maillog /var/log/kloxo/courier /var/log/kloxo/smtp.log /var/log/kloxo/pureftpd.log { + weekly + rotate 8 + create + compress + notifempty + missingok + postrotate + pkill -HUP syslogd + endscript +} +/home/httpd/*/stats/*_log { + weekly + rotate 8 + create 0664 apache apache + compress + notifempty + missingok +} + +/home/*/__processed_stats/*_log-* { + daily + rotate 30 + create 0750 root root + compress + notifempty + missingok +} +/home/kloxo/httpd/lighttpd/*.log { + weekly + rotate 8 + create 0664 apache apache + compress + notifempty + missingok +} + +/usr/local/lxlabs/ext/php/error.log { + weekly + rotate 8 + create 0664 root root + compress + notifempty + missingok +} diff --git a/kloxo/httpdocs/htmllib/lib/lib.php b/kloxo/httpdocs/htmllib/lib/lib.php index 1cf87d189d..abdd6df2c7 100755 --- a/kloxo/httpdocs/htmllib/lib/lib.php +++ b/kloxo/httpdocs/htmllib/lib/lib.php @@ -5865,16 +5865,14 @@ function setSomeScript() function setInitialLogrotate() { - return; // Kloxo 6.2.0 (#295) - log_cleanup("Initialize logrotate"); - - if (lxfile_exists("/etc/logrotate.d/kloxo")) { - log_cleanup("- Initialize process"); - - if (lxfile_exists("../file/kloxo.logrotate")) { - lxfile_cp("../file/kloxo.logrotate", "/etc/logrotate.d/kloxo"); - } - } + // Project #295 + // Added kloxo 6.1.18 + if (lxfile_exists("/etc/logrotate.d/kloxo")) { + if (lxfile_exists("../file/kloxo.logrotate")) { + log_cleanup("Installing kloxo logrotate"); + lxfile_cp("../file/kloxo.logrotate", "/etc/logrotate.d/kloxo"); + } + } } function restart_xinetd_for_pureftp()