diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /net-dns/nsd/files/nsd.initd-r1 |
reinit the tree, so we can have metadata
Diffstat (limited to 'net-dns/nsd/files/nsd.initd-r1')
-rwxr-xr-x | net-dns/nsd/files/nsd.initd-r1 | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/net-dns/nsd/files/nsd.initd-r1 b/net-dns/nsd/files/nsd.initd-r1 new file mode 100755 index 000000000000..a032cb226fd7 --- /dev/null +++ b/net-dns/nsd/files/nsd.initd-r1 @@ -0,0 +1,59 @@ +#!/sbin/openrc-run +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +description="NSD is an authoritative-only, high performance, open source name server" +extra_commands="configtest" +extra_started_commands="reload" + +# these can be overridden in /etc/conf.d/nsd if necessary +NSD_CONFIG="${NSD_CONFIG:-/etc/nsd/nsd.conf}" +NSD_CHECKCONF="${NSD_CHECKCONF:-/usr/sbin/nsd-checkconf}" +command="${NSD_BINARY:-/usr/sbin/nsd}" +command_args="-c ${NSD_CONFIG}" + +depend() { + need net + use logger +} + +get_pidfile() { + printf '%s' "$("${NSD_CHECKCONF}" -o pidfile "${NSD_CONFIG}")" +} + +checkconfig() { + if ! test -e "${NSD_CONFIG}"; then + eerror "You need to create an appropriate config file." + eerror "An example can be found in /etc/nsd/nsd.conf.sample" + return 1 + elif ! "${NSD_CHECKCONF}" "${NSD_CONFIG}"; then + eerror "You have errors in your configfile (${NSD_CONFIG})" + return $? + fi + return 0 +} + +configtest() { + ebegin "Checking ${SVCNAME} configuration" + checkconfig + eend $? +} + +start_pre() { + checkconfig || return $? + pidfile="$(get_pidfile)" + checkpath --directory --owner nsd:nsd "${pidfile%/*}" || return 1 +} + +stop_pre() { + checkconfig || return $? + pidfile="$(get_pidfile)" +} + +reload() { + checkconfig || return $? + pidfile="$(get_pidfile)" + ebegin "Reloading config and zone files" + kill -s HUP $(cat ${pidfile}) + eend $? +} |