summaryrefslogtreecommitdiff
path: root/pkgs/varnish/varnish.runit
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/varnish/varnish.runit')
-rwxr-xr-xpkgs/varnish/varnish.runit28
1 files changed, 28 insertions, 0 deletions
diff --git a/pkgs/varnish/varnish.runit b/pkgs/varnish/varnish.runit
new file mode 100755
index 0000000..e9e647f
--- /dev/null
+++ b/pkgs/varnish/varnish.runit
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+. /etc/varnish.conf
+
+BIN="/usr/sbin/varnishd"
+
+PID=`pidof %PPID $BIN`
+
+killjobs () {
+ kill $PID >&/dev/null
+}
+
+trap killjobs INT QUIT TERM EXIT KILL HUP
+
+if [ -z "$PID" ]
+then
+ $BIN $OPTS
+else
+ for P in $PID
+ do
+ watchpid $P &
+ done
+fi
+wait