[Slackbuilds-users] Squid: rc.squid doesn't stop Squid correctly
Nicolas Kovacs
info at microlinux.fr
Thu Oct 6 07:47:48 UTC 2011
Le 05/10/2011 13:48, Helmut Hullen a écrit :
>
> "squid" needs some time for shutting down - are these processes still
> running after (about) 2 minutes?
>
OK, I investigated a little bit, and I found a couple of reasons why
Squid wouldn't shutdown correctly.
A peek in /var/log/squid/cache.log indicated this:
...
WARNING: Could not write pid file
...
So I explicitly defined a PID file in squid.conf:
...
pid_filename /var/run/squid/squid.pid
...
Now the PID file is written correctly, but still, running:
# /etc/rc.d/rc.squid stop
wouldn't stop the squid processes. Took a peek in the rc.file, and here
it is:
--8<--------------------------------------------------------
squid_stop() {
COUNTDOWN=$(awk '/^shutdown_lifetime/ {print $2}' $SQUIDCFG)
[ -z "$COUNTDOWN" ] && COUNTDOWN=30
echo -n "Shutting down Squid in $COUNTDOWN seconds: "
$SQUIDCMD -k shutdown 2> /dev/null
while $SQUIDCMD -k check 2> /dev/null ; do
sleep 1
echo -n .
COUNTDOWN=$[ $COUNTDOWN - 1 ]
if [ $COUNTDOWN -le 0 ] ; then
$SQUIDCMD -k interrupt 2> /dev/null
sleep 1
break
fi
done
echo
}
--8<--------------------------------------------------------
Now I added the following option to squid.conf:
shutdown_lifetime 30 seconds
From here, it got parsed correctly, and now everything is working fine.
cheers,
Niki
--
Microlinux - Solutions informatiques 100% Linux et logiciels libres
7, place de l'église - 30730 Montpezat
Web : http://www.microlinux.fr
Mail : info at microlinux.fr
Tél. : 04 66 63 10 32
More information about the SlackBuilds-users
mailing list