Search squid archive

Re: How to set /etc/logrotate.d/squid to have good sarg reports?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hallo, Bartosz,

bartosz.c@xxxxxxxxx meinte am 29.11.12 in squid zum Thema Re:  How to set /etc/logrotate.d/squid to have good sarg reports?:

>> My system runs the "sarg" reports at the end of the day, as a
>> separate cronjob, and "logrotate" runs in the very early morning, as
>> part of "cron.daily".

[...]

> And after rotating you are having only one day in log file, dont you?

Yes, that may happen.

I've just written a quick and dirty script which deletes all sarg  
directories which are older than 3 months. It's invoked from the "/etc/ 
cron.monthly" directory, it could be invoked from a simple cron job  
instead.
The only thing you should change is "DocRoot".


#! /bin/bash
# loescht alte "sarg"-Verzeichnisse
# Helmut Hullen

DocRoot=/home/www/squid-reports

sargRef=/tmp/sarg$$
touch -d 'now - 3 months' $sargRef || exit 1

for Verz in $DocRoot/*
  do
    test -d $Verz || continue
    test -s $Verz/sarg-date || continue
    test $Verz/sarg-date -nt $sargRef && continue
    rm -rf $Verz
  done

rm -f $sargRef
#

# ======================================================================

# $Id: sarg-alt,v 1.1 2012-11-29 15:39:53+01 HHullen Exp $
# $Log: sarg-alt,v $
# Revision 1.1  2012-11-29 15:39:53+01  HHullen
# Start
#

This script is independent from every logrotate mechanism.

Viele Gruesse!
Helmut


[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux