summaryrefslogtreecommitdiff
blob: c996447d24c30b2852c6aba8af2a005d256b53ea (plain)
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
#!/bin/sh
#RCUPDATE:2 3 4:75:This line is required for script management

source /etc/rc.d/config/functions

SERVICE=squid
opts="start stop restart"

PIDFILE=/var/run/squid.pid
EXE=/usr/bin/squid

start() {
		local cachedir
		cachedir=`cat /etc/squid/squid.conf | grep '^cache_dir' | awk '{ print $3 }'`
		if [ ! -d ${cachedir}/00 ]
		then
			ebegin "Initializing squid cache"
		  	$EXE -z
			eend $? "Initialized cache." "Error initializing cache."
		fi
		ebegin "Starting $SERVICE"
     		start-stop-daemon --start --quiet --exec $EXE -- -sYD
		eend $? "Started $SERVICE." "Error Starting $SERVICE."
}

stop() {
		ebegin "Stopping $SERVICE"
		start-stop-daemon --stop --quiet --exec $EXE
		eend $? "Stopped $SERVICE." "Error Stopping $SERVICE."
}

restart() {

		stop
		start
}

doservice ${@}