[Pkg-varnish-devel] Bug#676491: Varnish is restarted two times when logrotate is executed

Yanick DELARBRE yanick.delarbre at smile.fr
Thu Jun 7 09:52:11 UTC 2012


Package: varnish
Version: 2.1.3-8
Severity: normal

When logrotate is executed, varnish is restarted two times.
The condition of this bug: varnish.log AND varnishncsa.log are presents.

root at varnish-test:~# cat /etc/logrotate.d/varnish
/var/log/varnish/varnish.log /var/log/varnish/varnishncsa.log {
   daily
   rotate 7
   missingok
   compress
   delaycompress
   missingok
   postrotate
     for service in varnishlog varnishncsa; do
       if /usr/bin/pgrep -P 1 $service >/dev/null; then
         /usr/sbin/invoke-rc.d $service reload > /dev/null
       fi
     done
   endscript
}

root at varnish-test:~# ls -lth /var/log/varnish/
total 0
-rw-r--r-- 1 root root 0 Jun  7 04:41 varnish.log
-rw-r--r-- 1 root root 0 Jun  7 04:41 varnishncsa.log

root at varnish-test:~# logrotate --force /etc/logrotate.conf

root at varnish-test:~# tail -n2 /var/log/syslog
Jun  7 04:46:12 varnish-test rsyslogd: [origin software="rsyslogd" 
swVersion="4.6.4" x-pid="919" x-info="http://www.rsyslog.com"] rsyslogd 
was HUPed, type 'lightweight'.
Jun  7 04:46:12 varnish-test rsyslogd: [origin software="rsyslogd" 
swVersion="4.6.4" x-pid="919" x-info="http://www.rsyslog.com"] rsyslogd 
was HUPed, type 'lightweight'.


In /etc/logrotate.d/varnish, the instruction sharedscripts permits to 
avoid this bug:

root at varnish-test:~# vim /etc/logrotate.d/varnish
/var/log/varnish/varnish.log /var/log/varnish/varnishncsa.log {
   daily
   rotate 7
   missingok
   compress
   delaycompress
   missingok
   #Avoid to reload two times varnish
   sharedscripts
   postrotate
     for service in varnishlog varnishncsa; do
       if /usr/bin/pgrep -P 1 $service >/dev/null; then
         /usr/sbin/invoke-rc.d $service reload > /dev/null
       fi
     done
   endscript
}





-- System Information:
Debian Release: 6.0.5
   APT prefers stable-updates
   APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages varnish depends on:
ii  adduser                   3.112+nmu2     add and remove users and groups
ii  gcc                       4:4.4.5-1      The GNU C compiler
ii  libc6                     2.11.3-3       Embedded GNU C Library: 
Shared lib
ii  libc6-dev [libc-dev]      2.11.3-3       Embedded GNU C Library: 
Developmen
ii  libncurses5               5.7+20100313-5 shared libraries for 
terminal hand
ii  libvarnish1               2.1.3-8        shared libraries for Varnish

varnish recommends no packages.

varnish suggests no packages.

-- no debconf information





More information about the Pkg-varnish-devel mailing list