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