#!/sbin/openrc-run # Copyright 2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 : ${KNOT_USER:=knot} : ${KNOT_GROUP:=knot} : ${KNOT_PIDFILE:=/run/knot.pid} : ${KNOT_CONFIG:=/etc/knot/knot.conf} name="knot" description="High-performance authoritative-only DNS server" command="/usr/sbin/knotd" command_args="-c ${KNOT_CONFIG}" command_user="${KNOT_USER}:${KNOT_GROUP}" command_background=true pidfile="${KNOT_PIDFILE}" extra_commands="checkconfig" extra_started_commands="reload" capabilities="^cap_net_bind_service,^cap_setpcap" checkconfig() { /usr/sbin/knotc conf-check 1>/dev/null || return 1 } reload() { checkconfig || return 1 ebegin "Reloading ${SVCNAME}" start-stop-daemon --signal HUP --pidfile $pidfile eend $? } start_pre() { if [ "${RC_CMD}" != "restart" ]; then checkconfig || return 1 fi } stop_pre() { if [ "${RC_CMD}" != "restart" ]; then checkconfig || return 1 fi }