RE: [squid-users] Startup Script for Squid on Redhat 7.2

From: Alain Delava (Trasys) <alain.delava@dont-contact.us>
Date: Tue, 30 Apr 2002 11:09:36 +0200

#!/bin/bash
#
# squid This shell script takes care of starting and stopping
# squid (proxy server).
#
# by Alain Delava - Last modif : 26/04/2002 16:33
#
#

pid_file=/var/run/squid.pid
squid_daemon=/usr/sbin/squid # which is a symlink to
/usr/local/squid/bin/squid
squid_conf=/usr/local/squid/etc/squid.conf

# 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 ${squid_daemon} ] || exit 0

[ -f ${squid_conf} ] || exit 0

# See how we were called.
case "$1" in
        start)
                action "Starting JunkBuster & Squid " ${squid_daemon}
                echo
                ;;
        stop)
                action "Stopping Squid " ${squid_daemon} -k shutdown
                sleep 1
                killall squid # if there are remaining processes :)
                echo
                ;;
        *)
                echo $"Usage: $0 {start|stop}"
                exit 1
esac
______________________________________________________________________
Alain DELAVA network engineer
Managed Services TRASYS
----------------------------------------------------------------------
mail alain.delava@trasys.be
phone + 32 (0)2/773.88.71
fax + 32 (0)2/773.79.40
web http://www.trasys.be
----------------------------------------------------------------------
For any problem please contact the Trasys FrontDesk (ext. 78.88) which
will forward your call to the right person/team.
----------------------------------------------------------------------
                   TRASYS sa/nv - Av. Arianelaan, 7
                       B-1200 Brussels (Belgium)
______________________________________________________________________

-----Original Message-----
From: warren, anthony [mailto:anthony.warren@medway.gov.uk]
Sent: mardi 30 avril 2002 11:00
To: squid-users@squid-cache.org
Subject: [squid-users] Startup Script for Squid on Redhat 7.2

Hi,

I have just installed Squid 2.5 Pre6 on Redhat 7.2. I can start squid
manually and it runs perfectly. What I am trying to do is get squid to
start
as the system boots. I found a site on the web that had the startup
script
which I have modified with my install paths, however when I run
./etc/rc.d/init.d/squid start I get the following error and squid does
not
start. (Script shown below)

[root@proxy init.d]# ./squid start
Starting squid: init_cache_dir ufs... squid
./squid: squid: command not found

Squid is installed in /usr/local/squid with the executable in the bin
dir,
my cache dir is /usr/local/squid/cache.

Please can someone help me!

Regards,

Anthony

Anthony Warren
Principal Network Engineer
Medway Council
E: anthony.warren@medway.gov.uk

#!/bin/bash
# squid This shell script takes care of starting and stopping
# Squid Internet Object Cache
#
# chkconfig: - 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: /usr/local/squid/etc/squid.conf

PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH

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

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

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

# check if the squid conf file is present
[ -f /usr/local/squid/etc/squid.conf ] || exit 0

# determine the name of the squid binary
[ -f /usr/local/squid/bin/squid ] && SQUID=squid
[ -z "$SQUID" ] && exit 0

# determine which one is the cache_swap directory
CACHE_SWAP=`sed -e 's/#.*//g' /usr/local/squid/etc/squid.conf | \
grep cache_dir | sed -e 's/cache_dir//' | \
cut -d ' ' -f 2`
[ -z "$CACHE_SWAP" ] && CACHE_SWAP=/usr/local/squid/cache

# default squid options
# -D disables initial dns checks. If you most likely will not to have an
# internet connection when you start squid, uncomment this
#SQUID_OPTS="-D"

RETVAL=0
case "$1" in
start)
echo -n "Starting $SQUID: "
for adir in $CACHE_SWAP; do
if [ ! -d $adir/00 ]; then
echo -n "init_cache_dir $adir... "
$SQUID -z -F 2>/dev/null
fi
done
$SQUID $SQUID_OPTS &
RETVAL=$?
echo $SQUID
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SQUID
;;

stop)
echo -n "Stopping $SQUID: "
$SQUID -k shutdown &
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
rm -f /var/lock/subsys/$SQUID
while : ; do
[ -f /var/run/squid.pid ] || break
sleep 2 && echo -n "."
done
echo "done"
else
echo
fi
;;

reload)
$SQUID $SQUID_OPTS -k reconfigure
exit $?
;;

restart)
$0 stop
$0 start
;;

status)
status $SQUID
$SQUID -k check
exit $?
;;

probe)
exit 0;
;;

*)
echo "Usage: $0 {start|stop|status|reload|restart}"
exit 1
esac

exit $RETVAL
Received on Wed May 01 2002 - 06:18:26 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:07:51 MST