mbox

squid init v3.1: Bugfix release

Message ID 1463408471-1292-1-git-send-email-matthias.fischer@ipfire.org
State Superseded
Headers

Message

Matthias Fischer May 17, 2016, 12:21 a.m. UTC
  - Fixed and adjusted non-working 'while'-loop for stopping still running
  '(squid-1)'-processes.

- Commented 'wait' after 'killproc ...'-block: until now, no troubles found.

- Cosmetic tuning.

Best,
Matthias

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
---
 src/initscripts/init.d/squid | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
  

Comments

Michael Tremer May 17, 2016, 1:14 a.m. UTC | #1
Don't comment anything out. Either we need a line or we don't.

On Mon, 2016-05-16 at 16:21 +0200, Matthias Fischer wrote:
> - Fixed and adjusted non-working 'while'-loop for stopping still running
>   '(squid-1)'-processes.
> 
> - Commented 'wait' after 'killproc ...'-block: until now, no troubles found.
> 
> - Cosmetic tuning.
> 
> Best,
> Matthias
> 
> Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
> ---
>  src/initscripts/init.d/squid | 21 ++++++++++++++-------
>  1 file changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/src/initscripts/init.d/squid b/src/initscripts/init.d/squid
> index 47bf182..e5c9b85 100644
> --- a/src/initscripts/init.d/squid
> +++ b/src/initscripts/init.d/squid
> @@ -95,9 +95,9 @@ case "$1" in
>  			iptables -t nat -F SQUID
>  		if [ -e /var/run/squid.pid ]; then
>  			boot_mesg -n "Shutting down Squid Proxy Server...\n"
> -			boot_mesg "(this may take up to a few minutes)."
> +			boot_mesg "(this may take up to a few minutes)"
>  			/usr/sbin/squid -k shutdown >/dev/null 2>&1
> -			evaluate_retval
> +#			evaluate_retval
>  
>  			# Stop squidGuard, updxlrator, squidclamav
>  			# and redirect_wrappers.
> @@ -107,31 +107,38 @@ case "$1" in
>  			killproc /usr/sbin/redirect_wrapper >/dev/null &
>  
>  			# Wait until all redirectors have been stopped.
> -			wait
> +#			wait
>  
>  			# If some squid processes are still running, wait up
> to 360 seconds
>  			# before we go on to kill all and delete entire cache
> structure.
> +
>  			n=0
> -			while [ /usr/sbin/squid -k check > /dev/null 2>&1 ]
> && [ $n -lt 360 ]; do
> -				sleep 1
> -				n=$(( ${n} + 1 ))
> +			while /usr/sbin/squid -k check > /dev/null 2>&1 && [
> $n -lt 360 ]; do
> +				sleep 2
> +				n=$(( ${n} + 2 ))
> +				echo -n .
>  			done
> +			echo ""
> +			echo "Done."
> +			echo "Shutdown time:" "$n" "seconds"
>  
>  			# If (squid-1) is still running after 360 seconds,
>  			# kill all squid processes and delete damaged cache
> structure.
>  			if ( pgrep -fl "(squid-1)" > /dev/null 2>&1 ); then
>  				killproc /usr/sbin/squid >/dev/null
>  				rm -rf /var/log/cache/*
> +				echo ""
>  				boot_mesg -n "You should not be reading this
> warning.\n"
>  				boot_mesg -n "Some squid-processes had to be
> killed after 360 seconds,\n"
>  				boot_mesg -n "so index file and cache
> contents had to be deleted.\n"
>  				boot_mesg -n "Therefore, the complete cache
> structure will be rebuild\n"
>  				boot_mesg "during next start."
>  				echo_warning
> +				echo ""
>  			else
>  				boot_mesg "All squid processes exited
> normally."
>  				echo_ok
> -				boot_mesg ""
> +				echo ""
>  			fi
>  		fi
>