]> err.no Git - varnish/commitdiff
Add init script for varnishlog
authorssm <ssm@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 18 May 2007 14:14:53 +0000 (14:14 +0000)
committerssm <ssm@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 18 May 2007 14:14:53 +0000 (14:14 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1455 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/debian/dirs
varnish-cache/debian/rules
varnish-cache/debian/varnish.varnishlog.init [new file with mode: 0755]

index 7e039356e78149abbe799791b1b550c4e027f05c..b591f2d844bcf99194d795598998cee6806b7be0 100644 (file)
@@ -3,5 +3,6 @@ usr/bin
 usr/lib
 usr/sbin
 var/log
+var/log/varnish
 var/lib/varnish
 usr/share/lintian/overrides/
index 01c7e54565209e57480df48e1773bea882049c2a..9d7b890435b3190104d7695c4d852e0c6d4f5023 100755 (executable)
@@ -83,6 +83,7 @@ binary-arch: build install
        dh_installdocs
        # Since varnish loses its cache on restart - we don't.
        dh_installinit -r
+       dh_installinit --name=varnishlog
        dh_installman
        dh_installexamples
        dh_link
diff --git a/varnish-cache/debian/varnish.varnishlog.init b/varnish-cache/debian/varnish.varnishlog.init
new file mode 100755 (executable)
index 0000000..def543a
--- /dev/null
@@ -0,0 +1,65 @@
+#! /bin/sh
+#
+# varnish       Control the varnish HTTP accelerator
+
+### BEGIN INIT INFO
+# Provides:          varnishlog
+# Required-Start:    $local_fs $network
+# Required-Stop:     $local_fs $network
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start HTTP accelerator log daemon
+# Description:       This script provides logging for varnish
+### END INIT INFO
+
+# Source function library
+. /lib/lsb/init-functions
+
+NAME=varnishlog
+DESC="HTTP accelerator log deamon"
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/bin/$NAME
+PIDFILE=/var/run/$NAME.pid
+LOGFILE=/var/log/varnish/varnish.log
+
+test -x $DAEMON || exit 0
+
+DAEMON_OPTS="-a -w ${LOGFILE} -D -P $PIDFILE"
+
+case "$1" in
+       start)
+               output=$(/bin/tempfile -s.varnish)
+               log_daemon_msg "Starting $DESC" 
+               log_progress_msg $NAME
+                if start-stop-daemon \
+                  --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- \
+                   ${DAEMON_OPTS} > ${output} 2>&1; then
+                       log_end_msg 0
+               else
+                       log_end_msg 1
+                       cat $output
+               fi
+               rm $output
+               ;;
+       stop)
+               log_daemon_msg "Stopping $DESC"
+               log_progress_msg $NAME
+               if start-stop-daemon \
+                  --stop --quiet --pidfile $PIDFILE --oknodo --retry 10 \
+                  --exec $DAEMON; then
+                       log_end_msg 0
+               else
+                       log_end_msg 1
+               fi
+               ;;
+       restart|force-reload)
+               $0 stop
+               $0 start
+               ;;
+       *)
+               log_success_msg "Usage: $0 {start|stop|restart|force-reload}"
+               exit 1
+        ;;
+esac
+
+exit 0