From: Riccardo on
I'm using Debian 5.0.3 I need to rotate these log files for Squid:

store.log
access.log
cache.log
rewrite.log (log of jesred package)
redirect.log (log of jesred log)

What's the right command (to insert among postrotate and endscript) in
logrotate script for
telling both to Squid and to Jesred to write again in .log files ?


1) test ! -e /var/run/squid.pid || /usr/sbin/squid -k rotate

2) /bin/kill -HUP `cat /var/run/squid.pid 2> /dev/null` 2> /dev/null
|| true

3) invoke-rc.d squid reload > /dev/null


I used 2) command where I send 'hang up' signal to Squid.
I want to be sure "all 5 log file" can rotate.
What do you think about 1) 2) 3) commands ? What's the better ?
From: unruh on
On 2010-05-11, Riccardo <ric.castellani(a)alice.it> wrote:
> I'm using Debian 5.0.3 I need to rotate these log files for Squid:
>
> store.log
> access.log
> cache.log
> rewrite.log (log of jesred package)
> redirect.log (log of jesred log)
>
> What's the right command (to insert among postrotate and endscript) in
> logrotate script for
> telling both to Squid and to Jesred to write again in .log files ?

You have to tell the programs logging onto those files to close them and
then reopen them. Some programs will do it automatically, some need to
be hit by some kill number, some need to be stopped and restarted.
I do not know what squid uses.
>
>
> 1) test ! -e /var/run/squid.pid || /usr/sbin/squid -k rotate
>
> 2) /bin/kill -HUP `cat /var/run/squid.pid 2> /dev/null` 2> /dev/null
>|| true
>
> 3) invoke-rc.d squid reload > /dev/null
>
>
> I used 2) command where I send 'hang up' signal to Squid.
> I want to be sure "all 5 log file" can rotate.
> What do you think about 1) 2) 3) commands ? What's the better ?

IF 1) actually does tell squid to close and open its log files, it is
obviously best. Squid does not stop, and its service is not interrupted.
2)I have no idea if 2 does the same as 1), and closes and reopens all
log files.
3) I believe stops squid and restarts it, but I do not know.