#!/sbin/openrc-run

name="gdnsd daemon"
extra_commands="checkconf"
extra_started_commands="reload"
description="Geographic Authoritative DNS server"
description_configtest="Run syntax tests for configuration files only"
description_reload="Reload zone data"
command_background=true
pidfile=/var/run/${RC_SVCNAME}.pid
command="/usr/sbin/gdnsd"
command_args="start"

depend() {
	need net
	use logger
	after firewall
	provide auth-dns
}

checkconf() {
	ebegin "Checking configuration of ${RC_SVCNAME}"
	gdnsd checkconf
	eend $?
}

stop_pre() {
	checkconf
}

reload() {
	ebegin "Reloading ${RC_SVCNAME} zone data"
	gdnsdctl reload-zones
	eend $?
}
