ALT Linux repos
S: | 6.3-alt1 |
5.0: | 3.0.STABLE15-alt0.M50.1 |
4.1: | 3.0.STABLE15-alt0.M41.1 |
4.0: | 3.0.STABLE15-alt0.M40.1 |
3.0: | 2.5.STABLE11-alt2 |
Group :: System/Servers
RPM: squid
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
#!/bin/sh
#
# /etc/init.d/squid
#
# 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: /etc/squid/squid.conf
# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
SourceIfNotEmpty /etc/sysconfig/network
SQUID=/usr/sbin/squid
# 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"
#Uncomment for makes squid write info in access.log by pieces as far as the
#receipt of data but not after downloading whole file.
#SQUID_OPTS="-D -x /tmp/squid"
LOCKFILE=/var/lock/subsys/squid
PIDFILE=/var/run/squid.pid
RETVAL=0
start()
{
is_yes "$NETWORKING" || return 0
CACHE_SWAP=`sed -e 's/#.*//g' /etc/squid/squid.conf | \
grep cache_dir | sed -e 's/cache_dir//' | \
sed -e 's/^ *//g' | cut -d ' ' -f 2`
[ -z "$CACHE_SWAP" ] && CACHE_SWAP=/var/spool/squid
for adir in $CACHE_SWAP; do
if [ ! -d $adir/00 ]; then
$SQUID -z -F 2>/dev/null
fi
done
ulimit -n 16384
start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user root -- squid $SQUID_OPTS
RETVAL=$?
return $RETVAL
}
stop()
{
stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user squid -- squid
RETVAL=$?
return $RETVAL
}
restart()
{
stop
start
}
reload()
{
action "Reloading squid service:" $SQUID -k reconfigure
RETVAL=$?
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
restart
;;
condstop)
if [ -e "$LOCKFILE" ]; then
stop
fi
;;
condrestart)
if [ -e "$LOCKFILE" ]; then
restart
fi
;;
condreload)
if [ -e "$LOCKFILE" ]; then
reload
fi
;;
status)
status --pidfile "$PIDFILE" --expect-user squid squid
RETVAL=$?
;;
*)
msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
RETVAL=1
esac
exit $RETVAL