]> git.pld-linux.org Git - packages/squid.git/blob - squid.init
- add initial value of DELAY_IN_RESTART (sysconfig in upgrade is marked as
[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 # description(es): Squid - Cache de Objetos de Internet.  Cache de objetos \
16 #               es una manera de almacenar objetos Internet (i.e. Datos \
17 #               disponibles vía protocolos HTTP, FTP y gopher) en un \
18 #               sistema más próximo al site solicitador que el sistema \
19 #               original en internet.  Navegadores www pueden usar el \
20 #               cache squid local como un servidor proxy HTTP, reduciendo \
21 #               tanto el tiempo de acceso así como el consumo de banda de \
22 #               comunicación.
23 # description(pt_BR): Squid - Cache de Objetos da Internet. Cache de objetos \
24 #               é uma maneira de armazenar objetos Internet (i.e. dados \
25 #               disponíveis via protocolos HTTP, FTP e gopher) em um \
26 #               sistema mais próximo ao site requisitante do que o sistema \
27 #               original na internet. Navegadores www podem usar o cache \
28 #               squid local como um servidor proxy HTTP, reduzindo o tempo \
29 #               de acesso bem como o consumo de banda de comunicação.
30 #
31 # pidfile:      /var/run/squid.pid
32 # config:       /etc/squid/squid.conf
33
34
35 # Source function library
36 . /etc/rc.d/init.d/functions
37
38 # Get network config
39 . /etc/sysconfig/network
40
41 # Get service config
42 [ -f /etc/sysconfig/squid ] && . /etc/sysconfig/squid
43
44 # Check that networking is up.
45 if is_yes "${NETWORKING}"; then
46         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then
47                 msg_network_down Squid
48                 exit 1
49         fi
50 else
51         exit 0
52 fi
53
54 # initial value:
55 DELAY_IN_RESTART=30
56
57 # Sanity check
58 [ -f /etc/squid/squid.conf ] || exit 0
59
60 RETVAL=0
61 # See how we were called.
62 case "$1" in
63   start)
64         # Check if the service is already running?
65         if [ ! -f /var/lock/subsys/squid ]; then
66                 msg_starting Squid
67                 daemon $SERVICE_RUN_NICE_LEVEL squid $SQUID_OPTS
68                 RETVAL=$?
69                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/squid
70         else
71                 msg_already_running Squid
72         fi
73         ;;
74   stop)
75         if [ -f /var/lock/subsys/squid ]; then
76                 # Stop daemons.
77                 msg_stopping Squid
78                 killproc squid
79                 RETVAL=$?
80                 rm -f /var/lock/subsys/squid >/dev/null 2>&1
81         else
82                 msg_not_running Squid
83         fi
84         ;;
85   restart)
86         $0 stop && nls -n "Waiting %s seconds..." "$DELAY_IN_RESTART" && sleep $DELAY_IN_RESTART && nls "done."
87         $0 start
88         exit $?
89         ;;
90   reload|force-reload)
91         if [ -f /var/lock/subsys/squid ]; then
92                 msg_reloading Squid
93                 busy
94                 squid -k reconfigure
95                 RETVAL=$?
96                 [ $RETVAL -ne 0 ] && RETVAL=7
97                 [ $RETVAL -eq 0 ] && ok || fail
98         else
99                 msg_not_running Squid >&2
100                 exit 7
101         fi
102         ;;
103   status)
104         status squid
105         exit $?
106         ;;
107   init)
108         nls "Initializing %s" squid
109         squid -z
110         ;;
111   *)
112         msg_usage "$0 {start|stop|init|restart|reload|force-reload|status}"
113         exit 3
114 esac
115
116 exit $RETVAL
This page took 0.092444 seconds and 4 git commands to generate.