6897c22c12
PR: ports/146319
84 lines
2.6 KiB
Bash
84 lines
2.6 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: varnishd
|
|
# REQUIRE: DAEMON
|
|
# KEYWORD: shutdown
|
|
|
|
#
|
|
# Add the following line to /etc/rc.conf to enable varnishd:
|
|
#
|
|
# varnishd_enable="YES"
|
|
#
|
|
# Configuration variables and their default values:
|
|
#
|
|
# varnishd_pidfile - full path to the PID file.
|
|
# default: "/var/run/varnishd.pid"
|
|
#
|
|
# varnishd_listen - address and port at which varnishd will listen for
|
|
# client requests.
|
|
# default: ":80"
|
|
#
|
|
# varnishd_admin - address and port at which varnishd will listen for
|
|
# administrative commands.
|
|
# default: "localhost:81"
|
|
#
|
|
# varnishd_backend - address of the backend server.
|
|
# default: "localhost:8080"
|
|
#
|
|
# varnishd_config - name of the varnishd config file.
|
|
# default: unset.
|
|
#
|
|
# varnishd_hash - hash algorithm
|
|
# default: "classic,16383"
|
|
#
|
|
# varnishd_storage - storage method and parameters.
|
|
# default: "file,/tmp,50%"
|
|
#
|
|
# varnishd_user - unprivileged user for the child process.
|
|
# default: "www"
|
|
#
|
|
# varnishd_group - unprivileged group for the child process.
|
|
# default: "www"
|
|
#
|
|
# varnishd_flags - complete command line arguments.
|
|
# default if varnishd_config is unset: "-P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -b ${varnishd_backend} -s ${varnishd_storage} -h ${varnishd_hash} -u ${varnishd_user} -g ${varnishd_group}"
|
|
# default if varnishd_config is set: "-P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -f ${varnishd_config} -s ${varnishd_storage} -h ${varnishd_hash} -u ${varnishd_user} -g ${varnishd_group}"
|
|
#
|
|
# See varnishd(1) for a detailed overview of command-line options.
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="varnishd"
|
|
rcvar=`set_rcvar`
|
|
|
|
command="%%PREFIX%%/sbin/${name}"
|
|
|
|
# read configuration and set defaults
|
|
load_rc_config ${name}
|
|
: ${varnishd_enable:="NO"}
|
|
: ${varnishd_pidfile:="/var/run/${name}.pid"}
|
|
: ${varnishd_listen:=":80"}
|
|
: ${varnishd_admin:="localhost:81"}
|
|
: ${varnishd_backend:="localhost:8080"}
|
|
: ${varnishd_config:=""}
|
|
: ${varnishd_storage:="file,/tmp,50%"}
|
|
: ${varnishd_hash:="classic,16383"}
|
|
: ${varnishd_user:="www"}
|
|
: ${varnishd_group:="www"}
|
|
if [ -n "${varnishd_config}" ] ; then
|
|
: ${varnishd_flags:="-P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -f ${varnishd_config} -s ${varnishd_storage} -h ${varnishd_hash} -u ${varnishd_user} -g ${varnishd_group}"}
|
|
else
|
|
: ${varnishd_flags:="-P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -b ${varnishd_backend} -s ${varnishd_storage} -h ${varnishd_hash} -u ${varnishd_user} -g ${varnishd_group}"}
|
|
fi
|
|
|
|
# If we leave these set, rc.subr will su to them before starting
|
|
# varnishd, which is not what we want.
|
|
unset varnishd_user
|
|
unset varnishd_group
|
|
|
|
pidfile="${varnishd_pidfile}"
|
|
run_rc_command "$1"
|