]> git.pld-linux.org Git - packages/squid.git/blob - squid.init
- s/DELAY_BETWEEN_RESTARTS/DELAY_IN_RESTART/
[packages/squid.git] / squid.init
1 #!/bin/sh
2 #
3 # squid         This shell script takes care of starting and stopping
4 #               Squid Internet Object Cache
5 #
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 \
10 #               available via the HTTP, FTP, and gopher protocols) on a \
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
21 . /etc/rc.d/init.d/functions
22
23 # Get network config
24 . /etc/sysconfig/network
25
26 # Get service config
27 [ -f /etc/sysconfig/squid ] && . /etc/sysconfig/squid
28
29 # Check that networking is up.
30 if is_no "${NETWORKING}"; then
31         msg_network_down Squid
32         exit 1
33 fi
34
35 # Sanity check
36 [ -f /etc/squid/squid.conf ] || exit 0
37
38 # See how we were called.
39 case "$1" in
40   start)
41         # Check if the service is already running?
42         if [ ! -f /var/lock/subsys/squid ]; then
43                 msg_starting Squid
44                 busy            
45                 daemon $SERVICE_RUN_NICE_LEVEL squid $SQUID_OPTS
46                 RETVAL=$?
47                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/squid
48         else
49                 msg_already_running Squid
50         fi
51         ;;
52   stop)
53         # Stop daemons.
54         if [ -f /var/lock/subsys/squid ]; then
55                 msg_stopping squid
56                 killproc squid
57                 rm -f /var/lock/subsys/squid >/dev/null 2>&1
58         else
59                 msg_not_running squid
60                 exit 1
61         fi
62         ;;
63   restart)
64         $0 stop
65         echo -n "Waiting $DELAY_IN_RESTART seconds..."
66         sleep $DELAY_IN_RESTART
67         echo "done."
68         $0 start
69         ;;
70   reload)
71         if [ -f /var/lock/subsys/squid ]; then
72                 msg_reloading squid
73                 busy
74                 squid -k reconfigure
75                 ok
76         else
77                 msg_not_running squid
78                 exit 1
79         fi
80         ;;
81   status)
82         status squid
83         exit $?
84         ;;
85   init)
86         echo "Initializing squid"
87         squid -z
88         ;;
89   *)
90         msg_usage "$0 {start|stop|status|restart|reload|init}"
91         exit 1
92 esac
93
94 exit $RETVAL
This page took 0.044592 seconds and 4 git commands to generate.