#!/bin/sh
#
# squid.init    rc.d file for squid
#
# Author:       Nigel Metheringham
#

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/squid/bin/squid ] || exit 0


# See how we were called.
case "$1" in
  start)
	 echo "Enabling squid cache"
	 # allow squid to start...
	 rm -f /etc/squid.disable
	 #
	 touch /var/lock/subsys/squid.init
	 ;;
  stop)
	echo -n "Disabling squid cache:"
	# This prevents it being restarted from init
	touch /etc/squid.disable
	echo -n " (disabling)"
	# Kill it off....
	pid=`pidofproc squid`
	if [ -n "$pid" ]; then
	  kill -TERM $pid
	  echo -n " squid($pid)"
	fi
	rm -f /var/lock/subsys/squid.init
	echo "."
	;;
  *)
	echo "Usage: squid.init {start|stop}"
	exit 1
esac

exit 0

