]> git.pld-linux.org Git - packages/squid.git/blame - squid.init
- updated
[packages/squid.git] / squid.init
CommitLineData
55811d08 1#!/bin/sh
f5a3e1f4 2#
18357e74 3# squid This shell script takes care of starting and stopping
4# Squid Internet Object Cache
5#
f5a3e1f4 6# chkconfig: 345 90 25
7#
8# description: Squid - Internet Object Cache. Internet object caching is \
9# a way to store requested Internet objects (i.e., data \
540c47ca 10# available via the HTTP, FTP, and gopher protocols) on a \
f5a3e1f4 11# system closer to the requesting site than to the source. \
12# Web browsers can then use the local Squid cache as a proxy \
13# HTTP server, reducing access time as well as bandwidth \
14# consumption.
15#
16# pidfile: /var/run/squid.pid
17# config: /etc/squid/squid.conf
18
19
20# Source function library
18357e74 21. /etc/rc.d/init.d/functions
22
f5a3e1f4 23# Get network config
18357e74 24. /etc/sysconfig/network
25
f5a3e1f4 26# Get service config
27[ -f /etc/sysconfig/squid ] && . /etc/sysconfig/squid
28
18357e74 29# Check that networking is up.
540c47ca 30if is_no "${NETWORKING}"; then
86dda5b5 31 msg_network_down Squid
f88fd7a4 32 exit 1
08ed9d58 33fi
18357e74 34
f5a3e1f4 35# Sanity check
18357e74 36[ -f /etc/squid/squid.conf ] || exit 0
37
f5a3e1f4 38# See how we were called.
18357e74 39case "$1" in
f5a3e1f4 40 start)
41 # Check if the service is already running?
42 if [ ! -f /var/lock/subsys/squid ]; then
540c47ca 43 msg_starting Squid
44 busy
04118a7e 45 daemon $SERVICE_RUN_NICE_LEVEL squid $SQUID_OPTS
f88fd7a4 46 RETVAL=$?
47 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/squid
f5a3e1f4 48 else
86dda5b5 49 msg_already_running Squid
f5a3e1f4 50 fi
f5a3e1f4 51 ;;
52 stop)
f88fd7a4 53 # Stop daemons.
540c47ca 54 if [ -f /var/lock/subsys/squid ]; then
f88fd7a4 55 msg_stopping squid
56 killproc squid
57 rm -f /var/lock/subsys/squid >/dev/null 2>&1
540c47ca 58 else
86dda5b5 59 msg_not_running squid
f88fd7a4 60 exit 1
61 fi
f5a3e1f4 62 ;;
47adef88 63 restart)
1c899079 64 $0 stop && echo -n "Waiting $DELAY_IN_RESTART seconds..." && sleep $DELAY_IN_RESTART && echo "done."
f5a3e1f4 65 $0 start
66 ;;
47adef88 67 reload)
68 if [ -f /var/lock/subsys/squid ]; then
69 msg_reloading squid
70 busy
71 squid -k reconfigure
72 ok
73 else
86dda5b5 74 msg_not_running squid
47adef88 75 exit 1
76 fi
77 ;;
f5a3e1f4 78 status)
79 status squid
540c47ca 80 exit $?
f5a3e1f4 81 ;;
5221fff5
GS
82 init)
83 echo "Initializing squid"
84 squid -z
85 ;;
f5a3e1f4 86 *)
86dda5b5 87 msg_usage "$0 {start|stop|status|restart|reload|init}"
f5a3e1f4 88 exit 1
18357e74 89esac
90
540c47ca 91exit $RETVAL
This page took 0.042381 seconds and 4 git commands to generate.