File: squid.rc

package info (click to toggle)
squid 1.1.21-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 2,828 kB
  • ctags: 3,705
  • sloc: ansic: 34,400; sh: 1,975; perl: 899; makefile: 559
file content (89 lines) | stat: -rw-r--r-- 1,744 bytes parent folder | download | duplicates (2)
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
#! /bin/sh
#
# squid		Startup script for the SQUID caching HTTP server.
#		This one is a bit different then usual because
#		a it has a shell script wrapper around it to watch
#		over it.
#
# Version:	@(#)squid.rc  1.22  20-Mar-1998  miquels@cistron.nl
#

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/lib/squid/RunCache
SQUID=/usr/sbin/squid
LIB=/usr/lib/squid
PIDFILE=/var/run/runcache.pid
SPIDFILE=/var/run/squid.pid

[ -x $SQUID ] || exit 0

start () {
	cd /var/spool/squid
	logdir=/var/log/squid
	export logdir
	start-stop-daemon --quiet --start \
		--pidfile /var/run/runcache.pid \
		--exec $DAEMON -- /etc/squid.conf < /dev/null &
	sleep 2
}

stop () {
	start-stop-daemon --stop --quiet --pidfile $PIDFILE
	start-stop-daemon --stop --quiet --pidfile $SPIDFILE --exec $SQUID
	#
	#	Now we have to wait until squid has _really_ stopped.
	#
	sleep 2
	if [ "`pidof -o %PPID -o $$ $SQUID`" != "" ]
	then
		echo -n "Waiting ."
		cnt=0
		while [ "`pidof -o %PPID -o $$ $SQUID`" != "" ]
		do
			cnt=`expr $cnt + 1`
			if [ $cnt -gt 40 ]
			then
				#
				#	Waited 80 seconds now. Fail.
				#
				echo -n " Failed.. "
				break
			fi
			sleep 2
			echo -n "."
		done
		[ "$1" = verbose ] && echo "done."
	else
		[ "$1" = verbose ] && echo "squid."
	fi
}

case "$1" in
    start)
	echo -n "Starting proxy server: "
	start
	echo "squid."
	;;
    stop)
	echo -n "Stopping proxy server: "
	stop verbose
	;;
    reload|force-reload)
	echo "Reloading squid configuration files"
	start-stop-daemon --stop --signal 1 \
		--pidfile $SPIDFILE --quiet --exec $SQUID
	;;
    restart)
	echo "Restarting proxy server: "
	stop
	start
	echo "squid."
	;;
    *)
	echo "Usage: /etc/init.d/squid {start|stop|reload|force-reload|restart}"
	exit 1
	;;
esac

exit 0