]>
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 |
31 | msg_Network_Down Squid | |
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 | |
96746b99 | 45 | squid -N $SQUID_OPTS & |
540c47ca | 46 | if ps -C squid >/dev/null 2>&1; then |
96746b99 | 47 | deltext;ok |
48 | else | |
49 | deltext;fail | |
50 | fi | |
540c47ca | 51 | RETVAL=$? |
52 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/squid | |
f5a3e1f4 | 53 | else |
540c47ca | 54 | msg_Already_Running Squid |
f5a3e1f4 | 55 | fi |
f5a3e1f4 | 56 | ;; |
57 | stop) | |
540c47ca | 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 | |
f5a3e1f4 | 67 | ;; |
540c47ca | 68 | restart) |
f5a3e1f4 | 69 | $0 stop |
70 | $0 start | |
71 | ;; | |
72 | status) | |
73 | status squid | |
540c47ca | 74 | exit $? |
f5a3e1f4 | 75 | ;; |
76 | *) | |
540c47ca | 77 | msg_Usage "$0 {start|stop|status|restart}" |
f5a3e1f4 | 78 | exit 1 |
18357e74 | 79 | esac |
80 | ||
540c47ca | 81 | exit $RETVAL |