RE: Start/Stop Squid as service

From: Rodney M. Savard <rodney@dont-contact.us>
Date: Mon, 1 Nov 1999 17:47:56 -0800

> Has anyone gotten Squid to start (& stop) on Linux as as system
> service (ie an rcx.d file) & if so, would you mind relating your
> experiences & sending me a copy of the file?

Hi Marc,

This is the script I use. There may be a better way, but this seems to
work pretty good:

#!/bin/sh

test -f /usr/local/squid/bin/squid || exit 0

PROGNAME="Squid Internet object cache"
PIDFILE=/var/run/squid.pid

case "$1" in
  start)
        if [ -f $PIDFILE ]
        then
          echo "$PROGNAME is already running."
        else
          echo -n "Starting $PROGNAME..."
          /usr/local/squid/bin/squid
          while [ ! -f $PIDFILE ] ; do
            sleep 1
          done
          echo " Done"
        fi
        ;;
  stop)
        if [ ! -f $PIDFILE ]
        then
          echo "$PROGNAME is not running."
        else
          echo -n "Stopping $PROGNAME..."
          kill `cat $PIDFILE`
          while [ -f $PIDFILE ] ; do
            sleep 1
          done
          echo " Done"
        fi
        ;;
  reload)
        /etc/init.d/squid stop
        /etc/init.d/squid start
        ;;
  *)
        echo "Usage: /etc/init.d/squid {start | stop | reload}"
        exit 1
esac

exit 0

---
Rodney M. Savard - Delphi Developer
Savard Software - Tri-Cities, Washington, USA
rodney@savard.com - http://www.savard.com
Received on Mon Nov 01 1999 - 23:15:22 MST

This archive was generated by hypermail pre-2.1.9 : Wed Apr 09 2008 - 11:57:31 MDT