* [PATCH] squid init v3.1: Bugfix release
@ 2016-05-16 14:21 Matthias Fischer
2016-05-16 15:14 ` Michael Tremer
0 siblings, 1 reply; 2+ messages in thread
From: Matthias Fischer @ 2016-05-16 14:21 UTC (permalink / raw)
To: development
[-- Attachment #1: Type: text/plain, Size: 2377 bytes --]
- 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(a)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
--
2.8.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] squid init v3.1: Bugfix release
2016-05-16 14:21 [PATCH] squid init v3.1: Bugfix release Matthias Fischer
@ 2016-05-16 15:14 ` Michael Tremer
0 siblings, 0 replies; 2+ messages in thread
From: Michael Tremer @ 2016-05-16 15:14 UTC (permalink / raw)
To: development
[-- Attachment #1: Type: text/plain, Size: 2695 bytes --]
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(a)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
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-16 15:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-16 14:21 [PATCH] squid init v3.1: Bugfix release Matthias Fischer
2016-05-16 15:14 ` Michael Tremer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox