[CentOS] Slightly OT: Cron for Logrotate and Squid

Wed Sep 27 00:47:34 UTC 2006
karl at klxsystems.net <karl at klxsystems.net>

Howdy list,

Hey does anyone know what the best cron job is to call logrotate to run
the squid logrotations?  -Or the subscribe address for a squid or
logrotate mailing list (can't seem to find anything other than the usual
MARC archives).

I have this in /etc/logrotate.conf

# rotate log files daily, they get too big otherwise, another story.
daily

# keep 8 weeks worth of backlogs e.g. 60 days
rotate 8

# create new (empty) log files after rotating old ones
create

# No way, don't compress on a busy cache box, too much load.
#compress

# Rotate logs for specific daemons here:
include /etc/logrotate.d
##############################################

I have this in /etc/logrotate.d/squid

/var/log/squid/access.log {
    daily
    rotate 60
    copytruncate
    #compress
    notifempty
    missingok
# same for the other two squid logs

# This script asks squid to rotate its logs on its own.
# Restarting squid is a long process and it is not worth
# doing it just to rotate logs
    postrotate
    /usr/sbin/squid -k rotate
    endscript
}
################################################

and it's been suggested to do this in Cron, but it *does not* look right
and is the part i'm most concerned about, I drew it slightly out of
context from here:
http://www.tldp.org/HOWTO/Bandwidth-Limiting-HOWTO/faq.html  It's the rm
-f statement I worry about.

#SQUID - logrotate
01 4 * * * root /opt/squid/bin/squid -k rotate; /usr/sbin/logrotate
/etc/logrotate.conf; /bin/rm -f /var/log/squid/*.log.0
####################################################################

Basically don't want to restart the squid daemon on my cache servers
because it's just too too nasty of a proposition.

Any suggestions for the proper way to call logrotate from Cron with regard
to squid in particular?

-karl