]> git.pld-linux.org Git - packages/squid.git/blobdiff - squid.init
- include some usable docs and FAQ instead of outdated ones
[packages/squid.git] / squid.init
index 3ddbef7b9aebb5b1a5e47562913007f5ae1751b5..3a410b7d32b7274fb6e809bffb584556dbcb8029 100644 (file)
@@ -7,11 +7,26 @@
 #
 # description: Squid - Internet Object Cache. Internet object caching is \
 #              a way to store requested Internet objects (i.e., data \
-#              available via the HTTP, FTP, and gopher protocols) on a \
+#              available via the HTTP, FTP, and gopher protocols) on a \
 #              system closer to the requesting site than to the source. \
 #              Web browsers can then use the local Squid cache as a proxy \
 #              HTTP server, reducing access time as well as bandwidth \
 #              consumption.
+# description(es): Squid - Cache de Objetos de Internet.  Cache de objetos \
+#              es una manera de almacenar objetos Internet (i.e. Datos \
+#              disponibles vía protocolos HTTP, FTP y gopher) en un \
+#              sistema más próximo al site solicitador que el sistema \
+#              original en internet.  Navegadores www pueden usar el \
+#              cache squid local como un servidor proxy HTTP, reduciendo \
+#              tanto el tiempo de acceso así como el consumo de banda de \
+#              comunicación.
+# description(pt_BR): Squid - Cache de Objetos da Internet. Cache de objetos \
+#              é uma maneira de armazenar objetos Internet (i.e. dados \
+#              disponíveis via protocolos HTTP, FTP e gopher) em um \
+#              sistema mais próximo ao site requisitante do que o sistema \
+#              original na internet. Navegadores www podem usar o cache \
+#              squid local como um servidor proxy HTTP, reduzindo o tempo \
+#              de acesso bem como o consumo de banda de comunicação.
 #
 # pidfile:     /var/run/squid.pid
 # config:      /etc/squid/squid.conf
 [ -f /etc/sysconfig/squid ] && . /etc/sysconfig/squid
 
 # Check that networking is up.
-if [ "${NETWORKING}" = "no" ]; then
-       echo "WARNING: Networking is down. Squid service can't be runed."
-       exit 1
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then
+               msg_network_down Squid
+               exit 1
+       fi
+else
+       exit 0
 fi
 
 # Sanity check
 [ -f /etc/squid/squid.conf ] || exit 0
 
-
+RETVAL=0
 # See how we were called.
 case "$1" in
   start)
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/squid ]; then
-               show Prepare squid cache
-               busy
-               if [ ! -d $CACHE_SWAP/00 ]; then
-                       squid -z -F &>/dev/null
-               fi
-               deltext;ok
-
-               show Starting squid
-               daemon squid $SQUID_OPTS
+               msg_starting Squid
+               daemon $SERVICE_RUN_NICE_LEVEL squid $SQUID_OPTS
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/squid
        else
-           echo "squid already is running"
+               msg_already_running Squid
        fi
-       touch /var/lock/subsys/squid
        ;;
   stop)
-       show Stopping squid
-       killproc squid  
-       rm -f /var/lock/subsys/squid
+       if [ -f /var/lock/subsys/squid ]; then
+               # Stop daemons.
+               msg_stopping Squid
+               if [ -f /var/run/squid.pid ]; then
+                       PID=$(filter_chroot `cat /var/run/squid.pid`)
+                       if [ -z "$PID" ]; then
+                               PID=0
+                       fi
+               else
+                       PID=0
+               fi
+               killproc squid
+               RETVAL=$?
+               if [ ! $PID -eq 0 ]; then
+                       show "Waiting for Squid to stop"
+                       busy
+                       while ps -U squid -o user | grep -q ^squid
+                       do
+                               sleep 1
+                       done
+                       ok
+               fi
+               rm -f /var/lock/subsys/squid >/dev/null 2>&1
+       else
+               msg_not_running Squid
+       fi
        ;;
-  restart|reload)
+  restart)
        $0 stop
        $0 start
+       exit $?
+       ;;
+  reload|force-reload)
+       if [ -f /var/lock/subsys/squid ]; then
+               msg_reloading Squid
+               busy
+               squid -k reconfigure
+               RETVAL=$?
+               [ $RETVAL -ne 0 ] && RETVAL=7
+               [ $RETVAL -eq 0 ] && ok || fail
+       else
+               msg_not_running Squid >&2
+               exit 7
+       fi
        ;;
   status)
        status squid
+       exit $?
+       ;;
+  init)
+       nls "Initializing %s" squid
+       squid -z
        ;;
   *)
-       echo "Usage: $0 {start|stop|status|restart|reload}"
-       exit 1
+       msg_usage "$0 {start|stop|init|restart|reload|force-reload|status}"
+       exit 3
 esac
 
-exit 0
+exit $RETVAL
This page took 0.315364 seconds and 4 git commands to generate.