Thanks Olivier, <div><br></div><div>For the FreeBSD startup script i'm now using...</div><div><br></div><div><div><font class="Apple-style-span" face="'courier new', monospace">#!/bin/sh</font></div><div><font class="Apple-style-span" face="'courier new', monospace">#</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"># $FreeBSD: ports/www/varnish/files/<a href="http://varnishncsa.in">varnishncsa.in</a>,v 1.4 2010/03/27 00:15:19 dougb Exp $</font></div><div><font class="Apple-style-span" face="'courier new', monospace">#</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"># PROVIDE: varnishncsa</font></div><div><font class="Apple-style-span" face="'courier new', monospace"># REQUIRE: DAEMON</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"># KEYWORD: shutdown</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">#</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"># Add the following line to /etc/rc.conf to enable varnishncsa:</font></div><div><font class="Apple-style-span" face="'courier new', monospace">#</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"># varnishncsa_enable="YES"</font></div><div><font class="Apple-style-span" face="'courier new', monospace">#</font></div><div><font class="Apple-style-span" face="'courier new', monospace"># Configuration variables and their default values:</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">#</font></div><div><font class="Apple-style-span" face="'courier new', monospace"># varnishncsa_pidfile - full path to the PID file.</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">#<span class="Apple-tab-span" style="white-space:pre">    </span>default: "/var/run/varnishncsa.pid"</font></div><div><font class="Apple-style-span" face="'courier new', monospace">#</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"># varnishncsa_file - full path to the log file.</font></div><div><font class="Apple-style-span" face="'courier new', monospace">#<span class="Apple-tab-span" style="white-space:pre">        </span>default: "/var/log/varnishncsa.log"</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">#</font></div><div><font class="Apple-style-span" face="'courier new', monospace"># varnishncsa_flags - command line arguments.</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">#<span class="Apple-tab-span" style="white-space:pre">    </span>default: "-D -P ${varnishncsa_pidfile} -a -c -w ${varnishncsa_file}"</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">#</font></div><div><font class="Apple-style-span" face="'courier new', monospace"># Add the following line to /etc/newsyslog.conf to rotate the log file</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"># once a day:</font></div><div><font class="Apple-style-span" face="'courier new', monospace">#</font></div><div><font class="Apple-style-span" face="'courier new', monospace"># /var/log/varnishncsa.log 640 7 * @T00 JB /var/run/varnishncsa.pid</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">#</font></div><div><font class="Apple-style-span" face="'courier new', monospace"># See varnishncsa(1) for a detailed overview of command-line options.</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">#</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">. /etc/rc.subr</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">name="varnishncsa"</font></div><div><font class="Apple-style-span" face="'courier new', monospace">rcvar=`set_rcvar`</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">command="/usr/local/bin/${name}"</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"># read configuration and set defaults</font></div><div>
<font class="Apple-style-span" face="'courier new', monospace">load_rc_config ${name}</font></div><div><font class="Apple-style-span" face="'courier new', monospace">: ${varnishncsa_enable:="NO"}</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">: ${varnishncsa_pidfile:="/var/run/${name}.pid"}</font></div><div><font class="Apple-style-span" face="'courier new', monospace">: ${varnishncsa_file:="/var/log/varnish/${name}.log"}</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">: ${varnishncsa_format:='%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"'}</font></div><div><font class="Apple-style-span" face="'courier new', monospace">: ${varnishncsa_flags:="-P ${varnishncsa_pidfile} -D -a -c -w ${varnishncsa_file} -F \"${varnishncsa_format}\""}</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">pidfile=${varnishncsa_pidfile}</font></div><div><font class="Apple-style-span" face="'courier new', monospace">run_rc_command "$1"</font></div>
<div><br></div><div><br></div><br><div class="gmail_quote">On Tue, Oct 4, 2011 at 12:44 PM, Olivier <span dir="ltr"><<a href="mailto:viapanda@gmail.com">viapanda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
You may want to read this:<br><a href="http://stackoverflow.com/questions/1661193/start-stop-daemon-quoted-arguments-misinterpreted" target="_blank">http://stackoverflow.com/questions/1661193/start-stop-daemon-quoted-arguments-misinterpreted</a><br>


<br>As far as having Ubuntu script behave, you may try something in the line of:<br>DAEMON_OPTS="-a -c -w ${LOGFILE} -D -P $PIDFILE"<br>TRIX="-F %t %h \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\" %{ncsa-start}i %{ncsa-end}o"<br>


<br>start_varnishncsa() {<div>.........<br>       --chuid $USER --exec ${DAEMON} -- ${DAEMON_OPTS} "${TRIX}" \:<br><br><br><br>Best,<br><br>- Olivier<br><br><br>2011/10/4 Mit Rowe <<a href="mailto:mit@stagename.com" target="_blank">mit@stagename.com</a>>:<div>
<div></div><div class="h5"><br>

> The trouble comes with me using a start-up script and quotes.<br>> For example, /usr/local/etc/rc.d/varnishncsa<br>> . /etc/rc.subr<br>> name="varnishncsa"<br>> rcvar=`set_rcvar`<br>> command="/usr/local/bin/${name}"<br>


> load_rc_config ${name}<br>> : ${varnishncsa_enable:="NO"}<br>> : ${varnishncsa_pidfile:="/var/run/${name}.pid"}<br>> : ${varnishncsa_file:="/var/log/${name}.log"}<br>> : ${varnishncsa_flags:="-P ${varnishncsa_pidfile} -D -a -c -w<br>


> ${varnishncsa_file}"}<br>> pidfile=${varnishncsa_pidfile}<br>> run_rc_command "$1"<br>><br>> if i stick a -F at the end of varnishncsa_flags that contains ""<br>> characters I get "unterminated quoted string" errors. I've tried<br>


> combinations of ', ", \", \' and so forth and haven't yet found the right<br>> method.<br>> Same thing happens with ubuntu's startup scripts. <br>> Anyone have a suggestion to resolve this, at least starting with the default<br>


> format?<br>> %h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i"<br>><br>><br>><br>><br>> On Fri, Sep 2, 2011 at 2:26 PM, Jacques <<a href="mailto:whshub@gmail.com" target="_blank">whshub@gmail.com</a>> wrote:<br>


>><br>>> I think I'm missing something.  We use the following without problem on<br>>> 3.0.1<br>>> varnishncsa  -F '%{X-Forwarded-For}i %l %u %t "%r" %s %b "%{Referer}i"<br>


>> "%{User-agent}i" "%{Cookie}i" "%{Varnish:hitmiss}x"' -X<br>>> 'pingdom$|\.png$|\.ico$|\.jpg$|\.gif$'<br>>><br>>><br>>> On Fri, Sep 2, 2011 at 9:22 AM, Mit Rowe <<a href="mailto:mit@stagename.com" target="_blank">mit@stagename.com</a>> wrote:<br>


>>><br>>>> Hello!<br>>>> I am using varnish 3.0.1 and have a question about varnishncsalog<br>>>> I would like to spit out extra parameters in my logs, so i'm attempting<br>>>> to use the -F command line flag.<br>


>>> However, my need for spaces seems to be causing some problems.<br>>>> for example...<br>>>> -F %h %t<br>>>> (which i don't expect to work)<br>>>> prints<br>>>> 127.0.0.1<NEWLINE><br>


>>> (and that's it)<br>>>> -F '%h %t'<br>>>> prints <br>>>> '127.0.0.1<NEWLINE><br>>>> -F "%h %t"<br>>>> prints<br>>>> "127.0.0.1<NEWLINE><br>


>>>  <br>>>> and <br>>>> -F %h\ %t<br>>>> prints<br>>>> 127.0.0.1\<NEWLINE><br>>>> Has anyone had any success specifying a log format containing spaces?<br>>>><br>


>>>  <br>>>><br>>>> --<br>>>> Will 'Mit' Rowe<br>>>> Stagename<br>>>> <a href="tel:1-866-326-3098" value="+18663263098" target="_blank">1-866-326-3098</a><br>
>>> <a href="mailto:mit@stagename.com" target="_blank">mit@stagename.com</a><br>

>>> <a href="http://www.stagename.com" target="_blank">www.stagename.com</a><br>>>> Twitter: @stagename<br>>>><br>>>> The information transmitted is intended only for the person or entity to<br>
>>> which it is addressed and may contain confidential and/or privileged<br>

>>> material. Any review, retransmission, dissemination or other use of this<br>>>> information by persons or entities other than the intended recipient is<br>>>> prohibited. If you received this transmission in error, please contact the<br>


>>> sender and delete all material contained herein from your computer. <br>>>><br>>>> _______________________________________________<br>>>> varnish-misc mailing list<br>>>> <a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>


>>> <a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>>><br>><br>><br>><br>> --<br>
> Will 'Mit' Rowe<br>

> Stagename<br>> <a href="tel:1-866-326-3098" value="+18663263098" target="_blank">1-866-326-3098</a><br>> <a href="mailto:mit@stagename.com" target="_blank">mit@stagename.com</a><br>> <a href="http://www.stagename.com" target="_blank">www.stagename.com</a><br>
> Twitter: @stagename<br>><br>> The information transmitted is intended only for the person or entity to<br>

> which it is addressed and may contain confidential and/or privileged<br>> material. Any review, retransmission, dissemination or other use of this<br>> information by persons or entities other than the intended recipient is<br>


> prohibited. If you received this transmission in error, please contact the<br>> sender and delete all material contained herein from your computer. <br>><br>> _______________________________________________<br>


> varnish-misc mailing list<br>> <a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>> <a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>


><br><br></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><span style="color:gray">Will 'Mit' Rowe<br>Stagename</span><i><br>
</i><span style="color:rgb(153, 153, 153)">1-866-326-3098</span><br><span style="color:rgb(153, 153, 153)"><a href="mailto:josh@stagename.com" style="color:rgb(42, 93, 176)" target="_blank">mit@stagename.com</a></span><br style="color:rgb(153, 153, 153)">
<span style="color:rgb(153, 153, 153)"><a href="http://www.stagename.com/" style="color:rgb(42, 93, 176)" target="_blank">www.stagename.com</a></span><br><span style="color:rgb(153, 153, 153)">Twitter: @stagename</span><br style="color:rgb(153, 153, 153)">
<br style="color:rgb(153, 153, 153)"><span style="font-size:8pt;color:rgb(153, 153, 153)"></span><i><span style="font-size:8pt;color:gray">The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of this information by persons or entities other than the intended recipient is prohibited. If you received this transmission in error, please contact the sender and delete all material contained herein from your computer.</span></i><span style="font-size:8pt;color:gray"></span> </span><br>

</div>