Commit b28db411 authored by tbrehm's avatar tbrehm

Fixed bug in logrotation.

parent 67cae4ac
......@@ -115,11 +115,12 @@ foreach($records as $rec) {
if(@is_file($logfile)) {
// Compress yesterdays logfile
exec("gzip -c $logfile > $logfile.gz");
unlink($logfile);
}
// delete logfiles after 30 days
$month_ago = date("Ymd",time() - 86400 * 30);
$logfile = escapeshellcmd($rec["document_root"].'/log/'.$yesterday.'-access.log.gz');
$logfile = escapeshellcmd($rec["document_root"].'/log/'.$month_ago.'-access.log.gz');
if(@is_file($logfile)) {
unlink($logfile);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment