public inbox for ipfire-scm@lists.ipfire.org
 help / color / mirror / Atom feed
* [git.ipfire.org] IPFire 2.x development tree branch, next, updated. 3fcc9b67fc7ab1886244a647dd7cf98f00e5c555
@ 2016-05-18 15:58 git
  0 siblings, 0 replies; only message in thread
From: git @ 2016-05-18 15:58 UTC (permalink / raw)
  To: ipfire-scm

[-- Attachment #1: Type: text/plain, Size: 5222 bytes --]

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".

The branch, next has been updated
       via  3fcc9b67fc7ab1886244a647dd7cf98f00e5c555 (commit)
       via  691b2836c0ffa54b3f7fc8d6f3b98377b3c9a470 (commit)
       via  6113575d81201591b2e8a76520579a4e7b7c5d46 (commit)
      from  e93a0b06fe1c55c41ce24c33449f16f4ce5e5c53 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3fcc9b67fc7ab1886244a647dd7cf98f00e5c555
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Wed May 18 16:17:21 2016 +0100

    squid: Fix indentation
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

commit 691b2836c0ffa54b3f7fc8d6f3b98377b3c9a470
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Wed May 18 16:16:12 2016 +0100

    squid: Kill redirector processes only after squid has stopped
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

commit 6113575d81201591b2e8a76520579a4e7b7c5d46
Author: Matthias Fischer <matthias.fischer(a)ipfire.org>
Date:   Tue May 17 21:33:24 2016 +0200

    squid: Rework initscript
    
    The initscript now takes care that the squid proxy server process
    is properly shut down. If that fails, it will remove the cache
    index and let it be recreated at the next start. A warning is
    shown to the user.
    
    The "flush" command will now remove the entire proxy cache.
    
    Signed-off-by: Matthias Fischer <matthias.fischer(a)ipfire.org>
    Signed-off-by: Arne Fitzenreiter <arne.fitzenreiter(a)ipfire.org>
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

-----------------------------------------------------------------------

Summary of changes:
 src/initscripts/init.d/squid | 68 +++++++++++++++++++++++++++-----------------
 1 file changed, 42 insertions(+), 26 deletions(-)

Difference in files:
diff --git a/src/initscripts/init.d/squid b/src/initscripts/init.d/squid
index abed90a..7255c0a 100644
--- a/src/initscripts/init.d/squid
+++ b/src/initscripts/init.d/squid
@@ -92,38 +92,55 @@ case "$1" in
 		;;
 
 	stop)
-			iptables -t nat -F SQUID
+		iptables -t nat -F SQUID
+
 		if [ -e /var/run/squid.pid ]; then
-			boot_mesg "Stopping Squid Proxy Server..."
+			boot_mesg -n "Stopping Squid Proxy Server (this may take up to a few minutes)..."
 			squid -k shutdown >/dev/null 2>&1
-			evaluate_retval
 
-			# Stop squidGuard, updxlrator, squidclamav
-			# and redirect_wrappers.
+			# If some squid processes are still running, wait up to 360 seconds
+			# before we go on to kill the remaining process(es) and delete damaged
+			# '/var/log/cache/swap.state'.
+			n=0
+			while squid -k check &>/dev/null && [ $n -lt 360 ]; do
+				# Print a dot every 6 seconds
+				[ $(( ${n} % 6 )) -eq 0 ] && boot_mesg -n .
+
+				n=$(( ${n} + 1 ))
+				sleep 1
+			done
+			boot_mesg "" # end line
+
+			# If (squid-1) is still running, kill all squid processes
+			if squid -k check &>/dev/null || pgrep -fl "(squid-1)" >/dev/null 2>&1; then
+				killproc /usr/sbin/squid >/dev/null
+				echo_failure
+
+				# Remove damaged journal of cache index
+				rm -f /var/log/cache/swap.state
+
+				boot_mesg -n "WARNING: squid could not be gracefully shut down." ${WARNING}
+				boot_mesg -n " The cache index was damaged and has been removed."
+				boot_mesg -n " The cache data has not been lost and the index will be"
+				boot_mesg -n " recreated at the next start."
+				boot_mesg "" ${NORMAL}
+				echo_warning
+			else
+				logger -t squid "squid shutdown time: ${n} seconds"
+
+				echo_ok
+			fi
+
+			# Kill any redirector processes that might have been left running
 			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
+
+		# Trash remain pid file from squid.
+		rm -f /var/run/squid.pid
 		;;
 
 	restart)
@@ -133,7 +150,7 @@ case "$1" in
 		;;
 
 	reconfigure)
-	/usr/sbin/squid -k reconfigure
+		/usr/sbin/squid -k reconfigure
 		;;
 
 	status)
@@ -143,8 +160,7 @@ case "$1" in
 
 	flush)
 		$0 stop
-		echo > /var/log/cache/swap.state
-		chown squid.squid /var/log/cache/swap.state
+		rm -rf /var/log/cache/*
 		sleep 1
 		$0 start
 		;;


hooks/post-receive
--
IPFire 2.x development tree

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-18 15:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-18 15:58 [git.ipfire.org] IPFire 2.x development tree branch, next, updated. 3fcc9b67fc7ab1886244a647dd7cf98f00e5c555 git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox