[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] Squid /etc/rc.d/init.d file



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here's the one from the Qube... you'll probably have to change the 
directories (it's in /home/squid2 on the Qube)...

#!/bin/sh
#
# squid.init:  Cobalt Squid startup script
#
# chkconfig: 3 75 25
# description: Starts and stops Squid web caching
#
# Gideon Glass  <gid@xxxxxxxxxxxxx>  980511
#

. /etc/rc.d/init.d/functions

. /etc/sysconfig/network

[ ${NETWORKING} = "no" ] && exit 0

SQUID=/home/squid2/bin/squid
SQUIDCONF=/etc/squid/squid.conf

[ -f $SQUID ] || exit 0

[ -f /etc/squid/CLEANING ] && exit 0

case "$1" in
  start)
        echo -n "Starting squid: "
        su squid -c "$SQUID -D -f $SQUIDCONF &"
        echo "done"
        rm -rf /home/squid2/junkcache* < /dev/null >& /dev/null &
        touch /var/lock/subsys/squid
        ;;
  stop)
        echo -n "Shutting down squid: "
        # this used to be nice and friendly.
        # squid refuses to die nicely sometimes,
        # so we need to be forceful.
        tries=0
        while ps auxwwww | grep '^squid' >& /dev/null ; do
                killall squid ksquid >& /dev/null
                sleep 1
                tries=`expr $tries + 1`
                if [ $tries -gt "45" ] ; then
                       echo "forcing squid to die"
                        killall -9 squid ksquid >& /dev/null
                fi
        done
        rm -f /var/lock/subsys/squid
        echo "done"
        ;;
  restart)
        $0 stop
        sleep 3
        $0 start
        ;;
  reload)
        su squid -c "$SQUID -k reconfigure -f $SQUIDCONF"
        ;;
  *)
        echo "Usage: squid.init {start|stop|restart|reload}"
        exit 1
esac

exit 0

- -- 
Bruce Timberlake

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+HbbIvLA2hUZ9kgwRApy7AJ0WUQGsN7U6FI5XRN9PSP5BzQwxeQCbBzcj
XbZAThW8nWvr/WAjgWVEfBA=
=x/4e
-----END PGP SIGNATURE-----