diff options
author | Mark Felder <feld@FreeBSD.org> | 2015-07-27 17:53:18 +0000 |
---|---|---|
committer | Mark Felder <feld@FreeBSD.org> | 2015-07-27 17:53:18 +0000 |
commit | 85db98685f29200ea0d4f873a758aebbbe1bedc9 (patch) | |
tree | 8477e99ad035529e1b32fcf205889d079d4ee86f /www/varnish4 | |
parent | 3a2c94d30abf0820efcd1639b72334effca898c8 (diff) | |
download | ports-85db98685f29200ea0d4f873a758aebbbe1bedc9.tar.gz ports-85db98685f29200ea0d4f873a758aebbbe1bedc9.zip |
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
Notes
Notes:
svn path=/head/; revision=392997
Diffstat (limited to 'www/varnish4')
-rw-r--r-- | www/varnish4/Makefile | 2 | ||||
-rw-r--r-- | www/varnish4/files/varnishlog.in | 27 | ||||
-rw-r--r-- | www/varnish4/files/varnishncsa.in | 31 |
3 files changed, 55 insertions, 5 deletions
diff --git a/www/varnish4/Makefile b/www/varnish4/Makefile index cf158e3508f9..deefae29c96c 100644 --- a/www/varnish4/Makefile +++ b/www/varnish4/Makefile @@ -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 diff --git a/www/varnish4/files/varnishlog.in b/www/varnish4/files/varnishlog.in index 5899399ab50e..3e9115f56ed6 100644 --- a/www/varnish4/files/varnishlog.in +++ b/www/varnish4/files/varnishlog.in @@ -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" diff --git a/www/varnish4/files/varnishncsa.in b/www/varnish4/files/varnishncsa.in index f92a9216e2a4..457c85d189ea 100644 --- a/www/varnish4/files/varnishncsa.in +++ b/www/varnish4/files/varnishncsa.in @@ -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" |