freebsd-ports/dns/knot/files/knot.in
Mark Felder 5445cec046 Previous commit to knot.in was truncated causing the rc script to be
broken.

Submitted by:	erwin
Sponsored by:	SupraNet Communications, Inc
2014-02-18 12:39:42 +00:00

58 lines
1.2 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: knot
# REQUIRE: SERVERS cleanvar
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable knot:
#
# knot_enable="YES": Set to NO by default.
# Set it to YES to enable knot.
# knot_config="": Set to /usr/local/etc/knot/knot.conf
# by default.
. /etc/rc.subr
name=knot
rcvar=knot_enable
load_rc_config ${name}
: ${knot_enable:=NO}
: ${knot_config="%%PREFIX%%/etc/knot/knot.conf"}
command=%%PREFIX%%/sbin/knotd
command_args="-c ${knot_config} -d"
control=%%PREFIX%%/sbin/knotc
pidfile=/var/run/knot/knot.pid
required_files=${knot_config}
extra_commands=reload
reload_cmd="${name}_reload"
start_precmd="${name}_prestart"
knot_prestart()
{
if [ ! -d /var/run/knot ]; then
install -d -o %%USERS%% -g %%GROUPS%% /var/run/knot
fi
if [ ! -d /var/db/knot ]; then
install -d -o %%USERS%% -g %%GROUPS%% /var/db/knot
fi
grep -v '#' ${knot_config} | grep -q -E 'knot.knot;|bind.bind;'
if [ $? -ne 0 ]; then
echo "Notice: not running as uid.gid knot.knot or bind.bind"
fi
${control} -c ${knot_config} checkconf
}
knot_reload()
{
echo "Reloading ${name}."
${control} -c ${knot_config} reload
}
run_rc_command "$1"