svn commit: r392997 - in head/www/varnish4: . files
Mark Felder
feld at FreeBSD.org
Mon Jul 27 17:53:20 UTC 2015
Author: feld
Date: Mon Jul 27 17:53:18 2015
New Revision: 392997
URL: https://svnweb.freebsd.org/changeset/ports/392997
Log:
Fix startup script order:
varnishncsa and varnishlog require varnishd to start successfully
mat reported some latency between starting varnishd and creation of
the _.vsm file used for communication, so a start_precmd has been added
to varnishncsa and varnishlog.
PR: 201586
Differential Revision: https://reviews.freebsd.org/D3208
Modified:
head/www/varnish4/Makefile
head/www/varnish4/files/varnishlog.in
head/www/varnish4/files/varnishncsa.in
Modified: head/www/varnish4/Makefile
==============================================================================
--- head/www/varnish4/Makefile Mon Jul 27 17:52:19 2015 (r392996)
+++ head/www/varnish4/Makefile Mon Jul 27 17:53:18 2015 (r392997)
@@ -2,7 +2,7 @@
PORTNAME= varnish
PORTVERSION= 4.0.3
-PORTREVISION= 6
+PORTREVISION= 7
CATEGORIES= www
MASTER_SITES= http://repo.varnish-cache.org/source/
PKGNAMESUFFIX= 4
Modified: head/www/varnish4/files/varnishlog.in
==============================================================================
--- head/www/varnish4/files/varnishlog.in Mon Jul 27 17:52:19 2015 (r392996)
+++ head/www/varnish4/files/varnishlog.in Mon Jul 27 17:53:18 2015 (r392997)
@@ -4,7 +4,7 @@
#
# PROVIDE: varnishlog
-# REQUIRE: DAEMON
+# REQUIRE: DAEMON varnishd
# KEYWORD: shutdown
#
@@ -44,5 +44,30 @@ load_rc_config ${name}
command="%%PREFIX%%/bin/${name}"
pidfile=${varnishlog_pidfile}
+start_precmd=precmd
+
+precmd()
+{
+ waitcount=0
+ vsm=%%PREFIX%%/varnish/$(hostname)/_.vsm
+
+ # wait no longer than 5s for _.vsm file to arrive from varnishd
+ while :
+ do
+ if [ -f ${vsm} ] ; then
+ break
+ else
+ case "${waitcount}" in
+ 5) echo "${name}: Failed to start. Missing ${vsm} ?"
+ break
+ ;;
+ *) echo "${name}: waiting for ${vsm}"
+ waitcount=$((waitcount+1))
+ sleep 1
+ ;;
+ esac
+ fi
+ done
+}
run_rc_command "$1"
Modified: head/www/varnish4/files/varnishncsa.in
==============================================================================
--- head/www/varnish4/files/varnishncsa.in Mon Jul 27 17:52:19 2015 (r392996)
+++ head/www/varnish4/files/varnishncsa.in Mon Jul 27 17:53:18 2015 (r392997)
@@ -4,7 +4,7 @@
#
# PROVIDE: varnishncsa
-# REQUIRE: DAEMON
+# REQUIRE: DAEMON varnishd
# KEYWORD: shutdown
#
@@ -21,7 +21,7 @@
# default: "/var/log/varnishncsa.log"
#
# varnishncsa_flags - command line arguments.
-# default: "-D -P ${varnishncsa_pidfile} -a -c -w ${varnishncsa_file}${varnishncsa_logformat:+ -P \"$varnishncsa_logformat\""
+# default: "-D -P ${varnishncsa_pidfile} -a -w ${varnishncsa_file}${varnishncsa_logformat:+ -P \"$varnishncsa_logformat\""
#
# varnishncsa_logformat - log file format.
# default: "" (uses varnishncsa's default format)
@@ -45,9 +45,34 @@ load_rc_config ${name}
: ${varnishncsa_enable:=NO}
: ${varnishncsa_pidfile=/var/run/${name}.pid}
: ${varnishncsa_file=/var/log/${name}.log}
-: ${varnishncsa_flags="-P ${varnishncsa_pidfile} -D -a -c -w ${varnishncsa_file}${varnishncsa_logformat:+ -F \"$varnishncsa_logformat\"}"}
+: ${varnishncsa_flags="-P ${varnishncsa_pidfile} -D -a -w ${varnishncsa_file}${varnishncsa_logformat:+ -F \"$varnishncsa_logformat\"}"}
command="%%PREFIX%%/bin/${name}"
pidfile=${varnishncsa_pidfile}
+start_precmd=precmd
+
+precmd()
+{
+ waitcount=0
+ vsm=%%PREFIX%%/varnish/$(hostname)/_.vsm
+
+ # wait no longer than 5s for _.vsm file to arrive from varnishd
+ while :
+ do
+ if [ -f ${vsm} ] ; then
+ break
+ else
+ case "${waitcount}" in
+ 5) echo "${name}: Failed to start. Missing ${vsm} ?"
+ break
+ ;;
+ *) echo "${name}: waiting for ${vsm}"
+ waitcount=$((waitcount+1))
+ sleep 1
+ ;;
+ esac
+ fi
+ done
+}
run_rc_command "$1"
More information about the svn-ports-all
mailing list