1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
#!/bin/sh
#
## Copyright (C) 1996-2025 The Squid Software Foundation and contributors
##
## Squid software is distributed under GPLv2+ license and includes
## contributions from numerous individuals and organizations.
## Please see the COPYING and CONTRIBUTORS files for details.
##
# Squid Internet Object Cache startup
# AUTHOR: Markus Gyger <mgyger@itr.ch>
# This is squid's startup file /sbin/init.d/squid or /etc/init.d/squid
PATH=/usr/local/squid/sbin:/usr/sbin:/usr/bin:/sbin:/bin
export PATH
config()
{
# SGI IRIX 6.2
if [ -f /sbin/chkconfig ]
then if /sbin/chkconfig squid
then if [ -f /var/config/squid.options ]
then . /var/config/squid.options
fi
SQUID=1
else SQUID=0
fi
# Digital UNIX
elif [ -f /usr/sbin/rcmgr ]
then SQUID=`/usr/sbin/rcmgr get SQUID 0`
SQUID_OPTIONS=`/usr/sbin/rcmgr get SQUID_OPTIONS "-s"`
SQUID_RESPAWN=`/usr/sbin/rcmgr get SQUID_RESPAWN 1`
# HP-UX 10 / Linux
elif [ -f /etc/rc.config ]
then . /etc/rc.config
# SUN Solaris 2
else SQUID=1
SQUID_OPTIONS="-s"
SQUID_RESPAWN=1
fi
[ 1 = "${SQUID-}" ]
}
respawn()
{
trap "" 1
fails=0
while [ $fails -le 5 ]
do start=`date +%d%H%M%S`
if "$@"
then logger -t "$1" -p local4.notice \
"respawn[$$]: Exiting due to shutdown"
return 0
fi
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
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
squid ${SQUID_OPTIONS-} -k shutdown || exit 1
;;
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
|