ports/dns/knot1/files/knot.in
Erwin Lansing 29cfe8ab21 Move dns/knot to knot1 now knot2 no longer is in beta.
PR:		201257
Submitted by:	Leo Vandewoestijne <freebsd@dns-lab.com> (maintainer)
Sponsored by:	DK Hostmaster A/S
2015-08-07 08:09:28 +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"