Skip to content
Snippets Groups Projects
Commit b28db411 authored by tbrehm's avatar tbrehm
Browse files

Fixed bug in logrotation.

parent 67cae4ac
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment