[squid-users] Error restarting squid from RPM

From: <fernando_at_lozano.eti.br>
Date: Tue, 20 May 2014 12:46:16 -0300

Hi,

I don't know if this affects only the RPM packaging or squid sources.
I'm
using Eliezer packages for CentOS 6, namely 3.4.3-1.el6.x86)64.

The issue is that sometimes "service squid restart" leaves old squid
processes running alongside newer ones. I have to "killall squid" and
start
again to have a working proxy.

I see "squid -k shutdown" does not wait for all squid kids to stop, and
this makes init.d/squid to leave such broken restart.

I coud just increate SQUID_SHUTDOWN_TIMEOUT at /etc/sysconfig/squid so
the
init.d/squid script wait a little longer, but i think the restart
command
should be more robust. So I propose the following simple change to the
init.d/squid script:

---------------
restart() {
  stop
  RETVAL=$?
  if [ $RETVAL -eq 0 ] ; then
  rm -rf $SQUID_PIDFILE_DIR/*
  start
  else
  echo "Failure stopping squid or stopping squid took too long. Please
check
before restarting."
  return 1
  fi
}
---------------

Instead of blindly calling start after stop, check if the stop function
returned ok or an error status code.

I think it's better having restart fail sometimes than having broken
squid
processes after restart.

[]s, Fernando Lozano
Received on Tue May 20 2014 - 15:46:25 MDT

This archive was generated by hypermail 2.2.0 : Wed May 21 2014 - 12:00:05 MDT