#!/sbin/openrc-run
# Copyright 2018 Hyperbola Project
# Distributed under the terms of the GNU General Public License v2

description="BIND service"

command="/usr/sbin/named"
command_args="-f -u named"
command_background="yes"
pidfile="/run/named/named.pid"
extra_started_commands="reload"

depend() {
	need net
	use logger
	provide dns
}

start_pre() {
	checkpath --directory --owner named:named --mode 0750 /var/run/named
}

reload() {
	ebegin "Reloading named.conf and zone files"
		start-stop-daemon --signal HUP exec "${command}" --pidfile "${pidfile}"
	eend $?
}
