Bob Vickers wrote:
... some words about starting and stopping squid ... removed
... startup script ... removed
It would be better to use the rc script inthe contrib directory of
squids source. if you modify this its easy to start and stop squid like
init does, and you will have the same auto-restart as RunCache has.
Modified rc script as attachement for reference (can be doen better but
works for my servers)
-- Daniel Schild Dienst- und Applikationsentwicklung Teleport Sachsen-Anhalt GmbH | RegioCom GmbH Tel: ++49 39203 8 3300 | ++49 39203 8 2030 Fax: ++49 39203 8 3399 | ++49 39203 8 2031 E-Mail: schild@tsa.de | schild@regiocom.net S-Mail: Steinfeldstr. 3, 39179 Barleben, Germany
#!/bin/sh
# Squid Internet Object Cache startup
# AUTHOR: Markus Gyger
# This is squid's startup file /sbin/init.d/squid or /etc/init.d/squid
PATH=/usr/local/squid/bin:/usr/local/squid/etc:/usr/sbin:/usr/bin:/sbin:/bin
export PATH
config()
{
SQUID=1
SQUID_OPTIONS="-Ys"
SQUID_RESPAWN=1
[ 1 = "${SQUID-}" ]
}
respawn()
{
trap "" 1
fails=0
while [ $fails -le 5 ]
do start=`date +%d%H%M%S`
$@
stop=`date +%d%H%M%S`
time=`expr $stop - $start`
[ "$time" -gt 10 ] && fails=0
fails=`expr $fails + 1`
done
logger -t "$1" -p local4.alert \
"respawn[$$]: Exiting due to repeated, frequent failures"
return 1
}
case $* in
start_msg)
echo "Start Squid Internet Object Cache"
;;
stop_msg)
echo "Stopping Squid Internet Object Cache"
;;
start)
config || exit 2 # Squid not enabled
if whence=`type squid 2>&1`
then trap "" 1
echo "Start Squid Internet Object Cache"
if [ 0 = "${SQUID_RESPAWN-}" ]
then
squid ${SQUID_OPTIONS-} &
else
respawn squid ${SQUID_OPTIONS-} &
fi
else echo "ERROR: $whence" >&2
exit 1
fi
;;
stop)
config || exit 2 # Squid not enabled
echo -n "Stopping Squid Internet Object Cache..."
killall S80squid
squid ${SQUID_OPTIONS-} -k shutdown && da=1
echo -n "waiting for Squid to shutdown..."
# loop 'til the process terminates
while [ $da -eq 1 ]; do
squid ${SQUID_OPTIONS-} -k check || da=0;
sleep 1
done
# we need this to make sure that a large cache can write its swap log.
sleep 60
echo "Done."
;;
reconf*|rotate|int*|debug|check|kill)
config
squid ${SQUID_OPTIONS-} -k "$1"
;;
*)
echo "usage: $0 {start|stop|reconfigure|rotate|interrupt|debug|check|kill}" >&2
echo " start start squid" >&2
echo " stop clean shutdown" >&2
echo " reconfigure reread configuration files" >&2
echo " rotate rotate log files" >&2
echo " interrupt quick clean shutdown " >&2
echo " debug toggle debug logging" >&2
echo " check check for running squid" >&2
echo " kill terminate squid by brute force" >&2
exit 1
;;
esac
[ $? -eq 0 ] # only 0 and 1 exit values allowed
exit
Received on Fri Jun 12 1998 - 03:55:25 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:40:42 MST