From owner-svn-ports-all@freebsd.org Mon Jul 27 17:53:20 2015 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 254CC9AC0FA; Mon, 27 Jul 2015 17:53:20 +0000 (UTC) (envelope-from feld@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB702E26; Mon, 27 Jul 2015 17:53:19 +0000 (UTC) (envelope-from feld@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RHrJ3P083639; Mon, 27 Jul 2015 17:53:19 GMT (envelope-from feld@FreeBSD.org) Received: (from feld@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RHrI7A083634; Mon, 27 Jul 2015 17:53:18 GMT (envelope-from feld@FreeBSD.org) Message-Id: <201507271753.t6RHrI7A083634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: feld set sender to feld@FreeBSD.org using -f From: Mark Felder Date: Mon, 27 Jul 2015 17:53:18 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r392997 - in head/www/varnish4: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 17:53:20 -0000 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"