source: products/vendor/Products.CacheSetup/current/Products/CacheSetup/utils/purgesquid @ 3296

Last change on this file since 3296 was 3296, checked in by fenix, 12 years ago

Load Products.CacheSetup?-1.2.1 into vendor/Products.CacheSetup?/current.

  • Property svn:executable set to *
File size: 1001 bytes
Line 
1PATH=/usr/bin:/sbin:/bin:/usr/sbin
2export PATH
3
4# determine the name of the squid binary
5[ -f /usr/sbin/squid ] && SQUID=squid
6[ -z "$SQUID" ] && exit 0
7
8# determine which one is the cache_swap directory
9CACHE_SWAP=`sed -e 's/#.*//g' /etc/squid/squid.conf | \
10        grep cache_dir |  awk '{ print $3 }'`
11[ -z "$CACHE_SWAP" ] && CACHE_SWAP=/var/spool/squid
12
13echo $CACHE_SWAP
14echo $SQUID
15
16echo -n  $"Stopping $SQUID: "
17$SQUID -k check >> /var/log/squid/squid.out 2>&1
18RETVAL=$?
19
20if [ $RETVAL -eq 0 ] ; then
21        $SQUID -k shutdown &
22        rm -f /var/lock/subsys/$SQUID
23        timeout=0
24        while : ; do
25                [ -f /var/run/squid.pid ] || break
26                if [ $timeout -ge $SQUID_SHUTDOWN_TIMEOUT ]; then
27                    echo
28                    return 1
29                fi
30                sleep 2 && echo -n "."
31                timeout=$((timeout+2))
32        done
33        echo "Stopped"
34        #echo_success
35        echo
36else
37        echo "Not running"
38        #echo_failure
39        echo
40fi
41#    return $RETVAL
42
43echo "Purging the cache"
44echo "" > $CACHE_SWAP/swap.state
45echo "Restarting squid"
46/etc/rc.d/init.d/squid start
Note: See TracBrowser for help on using the repository browser.