]> git.pld-linux.org Git - packages/squid.git/blob - squid.init
- cleaning
[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_yes "${NETWORKING}"; then
31         if [ ! -f /var/lock/subsys/network ]; then
32                 msg_network_down Squid
33                 exit 1
34         fi
35 else
36         exit 0
37 fi
38
39 # Sanity check
40 [ -f /etc/squid/squid.conf ] || exit 0
41
42 # See how we were called.
43 case "$1" in
44   start)
45         # Check if the service is already running?
46         if [ ! -f /var/lock/subsys/squid ]; then
47                 msg_starting Squid
48                 busy            
49                 daemon $SERVICE_RUN_NICE_LEVEL squid $SQUID_OPTS
50                 RETVAL=$?
51                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/squid
52         else
53                 msg_already_running Squid
54                 exit 1
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 && echo -n "Waiting $DELAY_IN_RESTART seconds..." && sleep $DELAY_IN_RESTART && echo "done."
70         $0 start
71         ;;
72   reload)
73         if [ -f /var/lock/subsys/squid ]; then
74                 msg_reloading Squid
75                 busy
76                 squid -k reconfigure
77                 ok
78         else
79                 msg_not_running Squid
80                 exit 1
81         fi
82         ;;
83   status)
84         status squid
85         exit $?
86         ;;
87   init)
88         nls "Initializing squid"
89         squid -z
90         ;;
91   *)
92         msg_usage "$0 {start|stop|init|restart|reload|status}"
93         exit 1
94 esac
95
96 exit $RETVAL
This page took 0.03763 seconds and 4 git commands to generate.