mirror of
https://git.freebsd.org/ports.git
synced 2025-06-29 00:20:40 -04:00
varnishlog and varnishncsa had a race condition with varnishd on startup as they will notice varnishd's leftover _.vsm file and try to connect to varnishd but occasionally fail due to varnishd not being fully operational yet. By adding "-t off" flag as default to varnishncsa and varnishlog they will wait indefinitely for varnishd to start up instead of just exiting. Other bugs fixed: * varnishncsa_logformat in rc.conf mostly works Unfortunately due to shell expansion we still cannot pass quotes (") so if you need those in your log format you will have to manage varnishncsa startup yourself. I apologize, but there's not much we can do at the moment. I'm working with upstream to allow loading configuration from a file. Note that Debian has complained too... * Default permissions for log and pidfiles have been corrected They are now correctly set to 664 for pidfiles and 644 for log files * Description of default flags for varnishncsa and varnishlog have been adjusted to reflect reality New features: * We now support "checkconfig" and "reload" options like on RedHat distributions You can do "service varnishd checkconfig" to validate your vcl is functional. Doing a "service varnishd reload" also works without interrupting service and creates a new vcl reflecting the date+timestamp. Varnishd now does a checkconfig before starting and will also prevent you from breaking a running instance by doing a "restart" with an invalid vcl. Thanks to many for the reports and testing. Differential Revision: https://reviews.freebsd.org/D4016
65 lines
1.5 KiB
Bash
65 lines
1.5 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: varnishlog
|
|
# REQUIRE: DAEMON varnishd
|
|
# KEYWORD: shutdown
|
|
|
|
#
|
|
# Add the following line to /etc/rc.conf to enable varnishlog:
|
|
#
|
|
# varnishlog_enable="YES"
|
|
#
|
|
# Configuration variables and their default values:
|
|
#
|
|
# varnishlog_pidfile - full path to the PID file.
|
|
# default: "/var/run/varnishlog.pid"
|
|
#
|
|
# varnishlog_file - full path to the log file.
|
|
# default: "/var/log/varnish.log"
|
|
#
|
|
# varnishlog_flags - command line arguments.
|
|
# default: "-t off -P ${varnishlog_pidfile} -D -a -A -w ${varnishlog_file}"
|
|
#
|
|
# Add the following line to /etc/newsyslog.conf to rotate the log file
|
|
# once a day:
|
|
#
|
|
# /var/log/varnish.log varnishlog:varnish 640 7 * @T00 JB /var/run/varnishlog.pid
|
|
#
|
|
# See varnishlog(1) for a detailed overview of command-line options.
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
name=varnishlog
|
|
rcvar=varnishlog_enable
|
|
|
|
load_rc_config ${name}
|
|
: ${varnishlog_enable:=NO}
|
|
: ${varnishlog_pidfile=/var/run/${name}.pid}
|
|
: ${varnishlog_file=/var/log/varnish.log}
|
|
: ${varnishlog_flags="-t off -P ${varnishlog_pidfile} -D -a -A -w ${varnishlog_file}"}
|
|
|
|
procname="%%PREFIX%%/bin/${name}"
|
|
command="/usr/sbin/daemon"
|
|
command_args="-f -u varnishlog ${procname} ${varnishlog_flags}"
|
|
pidfile=${varnishlog_pidfile}
|
|
start_precmd=precmd
|
|
|
|
precmd()
|
|
{
|
|
# varnishlog_flags gets applied too early if we don't do this.
|
|
rc_flags=""
|
|
|
|
if [ ! -e ${pidfile} ]; then
|
|
install -o varnishlog -g varnish -m 644 /dev/null ${pidfile};
|
|
fi
|
|
|
|
if [ ! -e ${varnishlog_file} ]; then
|
|
install -o varnishlog -g varnish -m 640 /dev/null ${varnishlog_file};
|
|
fi
|
|
}
|
|
|
|
run_rc_command "$1"
|