Skip to content

Commit cafdec2

Browse files
committed
Fixed: FS#1287 - ispconfig.log rotated twice
1 parent db377c6 commit cafdec2

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

install/lib/installer_base.lib.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,6 +1470,7 @@ public function install_ispconfig() {
14701470
//* Add Log-Rotation
14711471
if (is_dir('/etc/logrotate.d')) {
14721472
@unlink('/etc/logrotate.d/logispc3'); // ignore, if the file is not there
1473+
/* We rotate these logs in cron_daily.php
14731474
$fh = fopen('/etc/logrotate.d/logispc3', 'w');
14741475
fwrite($fh,
14751476
"/var/log/ispconfig/ispconfig.log { \n" .
@@ -1487,6 +1488,7 @@ public function install_ispconfig() {
14871488
" delaycompress \n" .
14881489
"}");
14891490
fclose($fh);
1491+
*/
14901492
}
14911493
}
14921494

server/cron_daily.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,13 @@ function setConfigVar( $filename, $varName, $varValue ) {
234234
exec("cat /dev/null > $logfile");
235235
}
236236

237+
// rotate the cron.log when it exceeds a size of 10 MB
238+
$logfile = '/var/log/ispconfig/cron.log';
239+
if(is_file($logfile) && filesize($logfile) > 10000000) {
240+
exec("gzip -c $logfile > $logfile.1.gz");
241+
exec("cat /dev/null > $logfile");
242+
}
243+
237244
#######################################################################################################
238245
// Cleanup website tmp directories
239246
#######################################################################################################

0 commit comments

Comments
 (0)