]> git.pld-linux.org Git - packages/varnish.git/blobdiff - varnishncsa.init
- HTTP_HDR_MAX_VAL 128 instead of 32
[packages/varnish.git] / varnishncsa.init
index 29fb507a6785fbcc478d1002681c8fc56b8665da..553e793d26acf049ef2e9c0909fc1231535e2bc8 100644 (file)
@@ -27,8 +27,22 @@ start() {
                return
        fi
 
+       # NCSA log format, to be used by HTTP log analyzers
+       if ! is_yes "$VARNISHNCSA_ENABLED"; then
+               return
+       fi
+
+       local opts
+       if is_yes "$LOG_BACKEND"; then
+               opts="$opts -b"
+       fi
+
+       if is_yes "$LOG_CLIENT"; then
+               opts="$opts -c"
+       fi
+
        msg_starting "Varnish NCSA logging daemon"
-       daemon --pidfile=$pidfile /usr/bin/varnishncsa -a -w $logfile -D -P $pidfile
+       daemon --pidfile $pidfile /usr/bin/varnishncsa -a -w $logfile -D -P $pidfile $opts
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/varnishncsa
 }
@@ -56,14 +70,36 @@ condrestart() {
        start
 }
 
+reload() {
+       if [ ! -f /var/lock/subsys/varnishncsa ]; then
+               msg_not_running "Varnish NCSA logging daemon"
+               RETVAL=7
+               return
+       fi
+
+       msg_reloading "Varnish NCSA logging daemon"
+       killproc --pidfile $pidfile varnishncsa -HUP
+}
+
+flush-logs() {
+       if [ ! -f /var/lock/subsys/varnishncsa ]; then
+               msg_not_running "Varnish NCSA logging daemon"
+               return
+       fi
+
+       show "Rotating %s logs" "Varnish NCSA logging daemon"
+       killproc --pidfile $pidfile varnishncsa -HUP
+       RETVAL=$?
+}
+
 RETVAL=0
 # See how we were called.
 case "$1" in
   start)
-       start
+       start
        ;;
   stop)
-       stop
+       stop
        ;;
   restart)
        stop
@@ -72,15 +108,18 @@ case "$1" in
   try-restart)
        condrestart 0
        ;;
-  force-reload)
-       condrestart 7
+  reload|force-reload)
+       reload
+       ;;
+  flush-logs)
+       flush-logs
        ;;
   status)
        status varnishncsa
        RETVAL=$?
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|flush-logs|status}"
        exit 3
 esac
 
This page took 0.04272 seconds and 4 git commands to generate.