freebsd-ports/www/fcgiwrap/files/fcgiwrap.in
Baptiste Daroussin 13d7c8e633 - remove useless addition of ${fcgiwrap_flags} to command_args
Reported by:	dougb
Approved by:	jadawin (co-mentor)
2010-08-23 13:39:41 +00:00

75 lines
1.5 KiB
Bash

#!/bin/sh
# $FreeBSD$
#
# fcgiwrap startup script
#
# PROVIDE: fcgiwrap
# REQUIRE: login
# KEYWORD: shutdown
#
# Add the following to /etc/rc.conf[.local] to enable this service
#
# fcgiwrap_enable="YES"
#
# You can fine tune others variables too:
# fcgiwrap_fib="NONE"
# fcgiwrap_socket="unix:/var/run/fcgiwrap.sock"
# this could also be:
# - tcp:[ipv4_addr]:port (for ipv4)
# - tcp6:[ipv6_addr]:port (for ipv6)
# fcgiwrap_flags=""
# Use fcgiwrap_user to run fcgiwrap as user
fcgiwrap_setfib() {
sysctl net.fibs >/dev/null 2>&1 || return 0
case "$fcgiwrap_fib" in
[Nn][Oo][Nn][Ee])
;;
*)
command="setfib -F ${fcgiwrap_fib} ${command}"
;;
esac
}
fcgiwrap_precmd() {
fcgiwrap_setfib
test -d /var/run/fcgiwrap || mkdir -p /var/run/fcgiwrap
if [ -n ${fcgiwrap_user} ]; then
chown -R ${fcgiwrap_user} /var/run/fcgiwrap
fi
}
fcgiwrap_cleansocket() {
# Workaround the fact that fcgiwrap doesn't cleanup his socket at stopping
case ${fcgiwrap_socket} in
unix*)
test -S ${fcgiwrap_socket#unix:} && rm -f ${fcgiwrap_socket#unix:}
;;
esac
}
. /etc/rc.subr
pidfile="/var/run/fcgiwrap/fcgiwrap.pid"
name="fcgiwrap"
rcvar=`set_rcvar`
procname="%%PREFIX%%/sbin/${name}"
command="/usr/sbin/daemon"
start_precmd="fcgiwrap_precmd"
stop_postcmd="fcgiwrap_cleansocket"
load_rc_config $name
fcgiwrap_enable=${fcgiwrap_enable:-"NO"}
fcgiwrap_fib=${fcgiwrap_fib:-"NONE"}
fcgiwrap_socket=${fcgiwrap_port:-"unix:/var/run/fcgiwrap/fcgiwrap.sock"}
command_args="-f -p ${pidfile} ${procname} -s ${fcgiwrap_socket}"
run_rc_command "$1"