]> git.pld-linux.org Git - packages/squid.git/blob - squid.init
- wait only if really stopping
[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 && echo -n "Waiting $DELAY_IN_RESTART seconds..." && sleep $DELAY_IN_RESTART && echo "done."
65         $0 start
66         ;;
67   reload)
68         if [ -f /var/lock/subsys/squid ]; then
69                 msg_reloading squid
70                 busy
71                 squid -k reconfigure
72                 ok
73         else
74                 msg_not_running squid
75                 exit 1
76         fi
77         ;;
78   status)
79         status squid
80         exit $?
81         ;;
82   init)
83         echo "Initializing squid"
84         squid -z
85         ;;
86   *)
87         msg_usage "$0 {start|stop|status|restart|reload|init}"
88         exit 1
89 esac
90
91 exit $RETVAL
This page took 0.040211 seconds and 4 git commands to generate.