#!/bin/sh # # squid This shell script takes care of starting and stopping # Squid Internet Object Cache # # chkconfig: 345 90 25 # # description: Squid - Internet Object Cache. Internet object caching is \ # a way to store requested Internet objects (i.e., data \ # available \ via the HTTP, FTP, and gopher protocols) on a \ # system closer to the requesting site than to the source. \ # Web browsers can then use the local Squid cache as a proxy \ # HTTP server, reducing access time as well as bandwidth \ # consumption. # # pidfile: /var/run/squid.pid # config: /etc/squid/squid.conf # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config [ -f /etc/sysconfig/squid ] && . /etc/sysconfig/squid # Check that networking is up. if [ "${NETWORKING}" = "no" ]; then echo "WARNING: Networking is down. Squid service can't be runed." exit 1 fi # Sanity check [ -f /etc/squid/squid.conf ] || exit 0 # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/squid ]; then show Prepare squid cache busy if [ ! -d $CACHE_SWAP/00 ]; then squid -z -F &>/dev/null fi deltext;ok show Starting squid squid -N $SQUID_OPTS & busy if ps ax | grep -v grep | grep -q squid ; then deltext;ok else deltext;fail fi else echo "squid already is running" fi touch /var/lock/subsys/squid ;; stop) show Stopping squid killproc squid rm -f /var/lock/subsys/squid ;; restart|reload) $0 stop $0 start ;; status) status squid ;; *) echo "Usage: $0 {start|stop|status|restart|reload}" exit 1 esac exit 0