literal name_enable wherever possible, and ${name}_enable when it's not, to prepare for the demise of set_rcvar(). In cases where I had to hand-edit unusual instances also modify formatting slightly to be more uniform (and in some cases, correct). This includes adding some $FreeBSD$ tags, and most importantly moving rcvar= to right after name= so it's clear that one is derived from the other.
57 lines
1.2 KiB
Bash
57 lines
1.2 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: linknx
|
|
# REQUIRE: DAEMON
|
|
|
|
#
|
|
# linknx_enable (bool): Set to "NO" by default. Set it
|
|
# to "YES" to enable linknx.
|
|
#
|
|
# linknx_console (str): The output of the daemon goes to this
|
|
# file. It is set to "/var/log/linknx.log"
|
|
# by default. Set it to "" to disable it.
|
|
# Recommended for production use.
|
|
#
|
|
# linknx_config (str): The default configuration file. By default
|
|
# there is no configuration file set.
|
|
#
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="linknx"
|
|
rcvar=linknx_enable
|
|
|
|
start_precmd="linknx_precmd"
|
|
|
|
: ${linknx_enable:="NO"}
|
|
: ${linknx_console:="/var/log/linknx.log"}
|
|
: ${linknx_pidfile:="/var/run/linknx.pid"}
|
|
: ${linknx_flags:="--pid-file=${linknx_pidfile}"}
|
|
|
|
command="/usr/local/bin/$name"
|
|
pidfile=${linknx_pidfile}
|
|
|
|
load_rc_config "$name"
|
|
|
|
linknx_precmd()
|
|
{
|
|
if [ -f "${linknx_console}" ]; then
|
|
echo "----------------" `date` "----------------" >> ${linknx_console}
|
|
fi
|
|
}
|
|
|
|
if [ "x${linknx_console}" != "x" ]; then
|
|
linknx_flags="${linknx_flags} --daemon=${linknx_console}"
|
|
else
|
|
linknx_flags="${linknx_flags} --daemon"
|
|
fi
|
|
|
|
if [ "x${linknx_config}" != "x" ]; then
|
|
linknx_flags="${linknx_flags} --config=${linknx_config}"
|
|
fi
|
|
|
|
run_rc_command "$1"
|