From 517d02ab1ea53f1a5a531cc80f4ad545eac87e79 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Tue, 11 Jun 2013 16:44:51 +0200 Subject: [PATCH] squid: Speed up the stop process. The squid proxy server has been blocked by unresponsive redirectors and it took ages to kill it in the past. To speed up the shutdown process, we will stop all redirector services at the same time. If the squid service is still running we will wait up to 30 seconds before a TERM and finaly a KILL signal will be sent. Fixes #10368. --- src/initscripts/init.d/squid | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/initscripts/init.d/squid b/src/initscripts/init.d/squid index 1a1425d0c..08a3029a2 100644 --- a/src/initscripts/init.d/squid +++ b/src/initscripts/init.d/squid @@ -86,10 +86,31 @@ case "$1" in boot_mesg "Stopping Squid Proxy Server..." squid -k shutdown >/dev/null 2>&1 evaluate_retval - killproc /usr/bin/squidGuard >/dev/null - killproc /usr/sbin/updxlrator >/dev/null - killproc /usr/bin/squidclamav >/dev/null + + # Stop squidGuard, updxlrator, squidclamav + # and redirect_wrappers. + killproc /usr/bin/squidGuard >/dev/null & + killproc /usr/sbin/updxlrator >/dev/null & + killproc /usr/bin/squidclamav >/dev/null & + killproc /usr/sbin/redirect_wrapper >/dev/null & + + # Wait until all redirectors have been stopped. + wait + + # If squid is still running, wait up to 30 seconds + # before we go on to kill it. + counter=30 + + while [ ${counter} -gt 0 ]; do + statusproc /usr/sbin/squid >/dev/null && break; + sleep 1 + counter=$(( ${counter} - 1)) + done + + # Kill squid service, if still running. killproc /usr/sbin/squid >/dev/null + + # Trash remain pid file from squid. rm -rf /var/run/squid.pid fi ;; -- 2.39.2