These changes are mainly meant for upcoming squid 3.5.xx:
- Raised 'while-loop'-time for stopping squid to 120 seconds.
- Changed the 'while-loop' from using 'statusproc' to 'squid -k check', since 'statusproc' didn't find the still running '(squid-1)'-process. Thus, 'squid' hadn't enough time to close the index. This led to a damaged 'swap.state'-file and "Rebuilding storage in /var/log/cache" always ended with "(dirty log)".
- Added some 'boot_mesg' lines in stop-routine.
- Changed the 'flush'-command to delete the entire 'swap.state'-file - it will be automatically rebuild during the next start.
Best, Matthias
Signed-off-by: Matthias Fischer matthias.fischer@ipfire.org --- src/initscripts/init.d/squid | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/src/initscripts/init.d/squid b/src/initscripts/init.d/squid index abed90a..5d9521b 100644 --- a/src/initscripts/init.d/squid +++ b/src/initscripts/init.d/squid @@ -108,22 +108,28 @@ case "$1" in # Wait until all redirectors have been stopped. wait
- # 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=30 - - while [ ${counter} -gt 0 ]; do - statusproc /usr/sbin/squid >/dev/null && break; + n=0 + while /usr/sbin/squid -k check && [ $n -lt 120 ]; do sleep 1 - counter=$(( ${counter} - 1)) + n=$(( ${n} + 1 )) done
- # Kill squid service, if still running. - killproc /usr/sbin/squid >/dev/null + # If (squid-1) is still running, kill all squid processes + # and delete damaged '/var/log/cache/swap.state'. + if ( ps ax | grep "(squid-1)$" ); then + killproc /usr/sbin/squid >/dev/null + /bin/rm -f /var/log/cache/swap.state + boot_mesg "(squid-1) was killed after 120 seconds." + else + boot_mesg "(squid-1) exited normally, shutdown OK." + fi + fi
- # Trash remain pid file from squid. + # Delete remaining pid file from squid if it STILL exists. rm -rf /var/run/squid.pid - fi + ;;
restart) @@ -143,8 +149,7 @@ case "$1" in
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 ;;