From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthias Fischer To: development@lists.ipfire.org Subject: [PATCH] squid: Update-suggestion for initscript Date: Wed, 11 May 2016 20:46:46 +0200 Message-ID: <1462992406-1395-1-git-send-email-matthias.fischer@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6345253791154649605==" List-Id: --===============6345253791154649605== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Path fix for squid. Changed loop detecting if 'squid' is still running. Added '/bin/rm -f /var/log/cache/swap.state' after killing 'squid'. Changed flush option to '/bin/rm -f /var/log/cache/swap.state'. Signed-off-by: Matthias Fischer --- src/initscripts/init.d/squid | 47 +++++++++++++++++++++++++++---------------= -- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/src/initscripts/init.d/squid b/src/initscripts/init.d/squid index c641c7d..eecad12 100644 --- a/src/initscripts/init.d/squid +++ b/src/initscripts/init.d/squid @@ -33,21 +33,22 @@ transparent() { CONN_TYPE=3D`echo "$LINE" | awk -F, '{ print $5 }'` if [ "$CONN_TYPE" !=3D "net" ]; then continue - fi =20 - iptables -t nat -A SQUID -i $1 -p tcp -d `echo "$LINE" | awk -F, '{ prin= t $13 }'` --dport 80 -j RETURN + fi + iptables -t nat -A SQUID -i $1 -p tcp -d `echo "$LINE" | awk -F, '{ print = $13 }'` --dport 80 -j RETURN done < $FILE - =09 + if [ "$RED_TYPE" =3D=3D "STATIC" ]; then iptables -t nat -A SQUID -i $1 -p tcp -d $RED_NETADDRESS/$RED_NETMASK --d= port 80 -j RETURN fi - =09 + iptables -t nat -A SQUID -i $1 -p tcp -d $LOCALIP --dport 80 -j RETURN - =09 + iptables -t nat -A SQUID -i $1 -p tcp --dport 80 -j REDIRECT --to-port "${= TRANSPARENT_PORT}" } =20 case "$1" in start) + getpids "squid" =20 if [ -n "${pidlist}" ]; then @@ -93,14 +94,16 @@ case "$1" in ;; =20 stop) + iptables -t nat -F SQUID if [ -e /var/run/squid.pid ]; then boot_mesg "Stopping Squid Proxy Server..." - squid -k shutdown >/dev/null 2>&1 + /usr/sbin/squid -k shutdown >/dev/null 2>&1 evaluate_retval =20 # Stop squidGuard, updxlrator, squidclamav - # and redirect_wrappers. =09 + # and redirect_wrappers. + killproc /usr/bin/squidGuard >/dev/null & killproc /usr/sbin/updxlrator >/dev/null & killproc /usr/bin/squidclamav >/dev/null & @@ -109,22 +112,30 @@ case "$1" in # Wait until all redirectors have been stopped. wait =20 - # If squid is still running, wait up to 30 seconds + # If squid is still running, wait up to 120 seconds # before we go on to kill it. - counter=3D30 =20 - while [ ${counter} -gt 0 ]; do - statusproc /usr/sbin/squid >/dev/null && break; + n=3D0 + while /usr/sbin/squid -k check && [ $n -lt 120 ]; do sleep 1 - counter=3D$(( ${counter} - 1)) + echo -n . + n=3D`/usr/bin/expr $n + 1` + done =20 - # Kill squid service, if still running. +# Kill squid service, if still running. killproc /usr/sbin/squid >/dev/null =20 - # Trash remain pid file from squid. - rm -rf /var/run/squid.pid=09 +# Delete - damaged - /var/log/cache/swap.state + /bin/rm -f /var/log/cache/swap.state + + fi + + # Delete remaining pid file from squid if it STILL exists. + if [ -e '/var/run/squid.pid' ]; then + rm -rf /var/run/squid.pid fi + ;; =20 restart) @@ -141,14 +152,14 @@ case "$1" in statusproc /usr/sbin/squid statusproc /usr/lib/squid/unlinkd ;; - =09 + flush) $0 stop - echo > /var/log/cache/swap.state - chown squid.squid /var/log/cache/swap.state + /bin/rm -f /var/log/cache/swap.state sleep 1 $0 start ;; + setperms) chown -R nobody.squid /var/updatecache/ ;; --=20 2.8.2 --===============6345253791154649605==--