]> git.pld-linux.org Git - packages/squid.git/blob - squid.init
- Cache directories are no longer initialized from /etc/rc.d/init.d/squid
[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                 squid -N $SQUID_OPTS &
46                 if ps -C squid >/dev/null 2>&1; then
47                     deltext;ok
48                 else
49                     deltext;fail
50                 fi
51                 RETVAL=$?
52                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/squid
53         else
54             msg_Already_Running Squid
55         fi
56         ;;
57   stop)
58         # Stop daemons.
59         if [ -f /var/lock/subsys/squid ]; then
60                 msg_stopping squid
61                 killproc squid
62                 rm -f /var/lock/subsys/squid >/dev/null 2>&1
63         else
64                 msg_Not_Running squid
65                 exit 1
66         fi
67         ;;
68   restart)
69         $0 stop
70         $0 start
71         ;;
72   status)
73         status squid
74         exit $?
75         ;;
76   *)
77         msg_Usage "$0 {start|stop|status|restart}"
78         exit 1
79 esac
80
81 exit $RETVAL
This page took 0.041258 seconds and 4 git commands to generate.