freebsd-ports/www/interchange/files/interchange.in
Doug Barton 9aac569eaa Move the rc.d scripts of the form *.sh.in to *.in
Where necessary add $FreeBSD$ to the file

No PORTREVISION bump necessary because this is a no-op
2012-08-05 23:19:36 +00:00

53 lines
1.5 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: interchange
# REQUIRE: NETWORKING SERVERS
# BEFORE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable Interchange:
# interchange_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable Interchange
# interchange_config (str): Default config file:
# /usr/local/interchange/interchange.cfg
# interchange_args (str): Custom additional arguments to be passed
# to interchange (default empty).
#
. /etc/rc.subr
name="interchange"
rcvar=interchange_enable
interchange_enable=${interchange_enable:-"NO"}
interchange_config=${interchange_config:-"%%PREFIX%%/interchange/interchange.cfg"}
interchange_args=${interchange_args:-""}
load_rc_config $name
interchange_user="interch"
rundir="/var/run/interchange"
pidfile="${rundir}/${name}.pid"
command="%%PREFIX%%/bin/interchange"
command_interpreter="%%PREFIX%%/bin/perl"
command_args="--config=${interchange_config} ${interchange_args}"
start_cmd="interchange_cmd"
stop_cmd="interchange_cmd --stop"
restart_cmd="interchange_cmd --restart"
reload_cmd="interchange_cmd --restart"
interchange_cmd()
{
su -l ${interchange_user} -c "exec env PERL_SIGNALS=unsafe \
${command} -pidfile ${pidfile} PIDfile=${pidfile} \
-rundir ${rundir} SocketFile=${rundir}/socket \
IPCsocket=${rundir}/socket.ipc ${command_args} $1"
}
run_rc_command "$1"