]> git.pld-linux.org Git - packages/squid.git/blobdiff - squid.init
- rebuild with gnutls 3.5
[packages/squid.git] / squid.init
index 03c8a6a49c9ecc2ba38ad5bfd8a2cd0fb7dde350..b09f17a2810312e40a256538ea8e1ef6e4cec825 100644 (file)
@@ -76,7 +76,7 @@ start() {
        if [ ! -f /var/lock/subsys/squid ]; then
                check_cache_dirs
                msg_starting Squid
-               daemon squid $SQUID_OPTS
+               daemon /usr/sbin/squid $SQUID_OPTS
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/squid
        else
@@ -114,10 +114,9 @@ stop() {
 }
 
 # check that squid config is ok
-# NOTE: needs running squid
 configtest() {
        show "Checking squid config syntax"
-       squid -k check >> /var/log/squid/squid.out 2>&1
+       squid -k parse >> /var/log/squid/squid.out 2>&1
        RETVAL=$?
        [ $RETVAL = 0 ] && ok || fail
 }
@@ -148,6 +147,21 @@ restart() {
        start
 }
 
+condrestart() {
+       # if service is up, do configtest
+       if [ -f /var/lock/subsys/squid ]; then
+               configtest
+               if [ $RETVAL != 0 ]; then
+                       exit 1
+               fi
+               stop
+               start
+       else
+               msg_not_running Squid
+               RETVAL=0
+       fi
+}
+
 RETVAL=0
 # See how we were called.
 case "$1" in
@@ -157,10 +171,13 @@ case "$1" in
   stop)
        stop
        ;;
-  restart|force-reload)
+  restart)
        restart
        ;;
-  reload)
+  try-restart)
+       condrestart
+       ;;
+  reload|force-reload)
        reload
        ;;
   status)
@@ -172,7 +189,7 @@ case "$1" in
        check_cache_dirs
        ;;
   *)
-       msg_usage "$0 {start|stop|init|restart|reload|force-reload|status}"
+       msg_usage "$0 {start|stop|init|restart|try-restart|reload|force-reload|status}"
        exit 3
 esac
 
This page took 0.057875 seconds and 4 git commands to generate.