This repository has been archived on 2024-03-03. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
adlin/pkg/nsd/init
2020-02-21 01:40:15 +01:00

28 lines
774 B
Text
Executable file

#!/sbin/openrc-run
description="NSD is an authoritative-only, high performance, open source name server"
checkconf=/usr/sbin/nsd-checkconf
cfgfile=${NSD_CONFIG:-/etc/nsd/nsd.conf}
pidfile=$($checkconf -o pidfile $cfgfile)
pidfile=${pidfile:-/var/run/nsd/nsd.pid}
command=/usr/sbin/nsd
command_args=""
depend() {
use logger
}
start_pre() {
[ -f /etc/nsd/nsd.conf ] || {
cp -r /etc/nsd.sample/* /etc/nsd/
nsd-control-setup
}
ebegin
checkpath --directory --owner nsd:nsd ${pidfile%/*}
checkpath --directory --owner nsd:nsd /var/db/nsd/
$checkconf $cfgfile
[ "$cfgfile" = "/etc/nsd/nsd.conf" ] || command_args="$command_args -c $cfgfile"
[ "$pidfile" = "/var/run/nsd/nsd.pid" ] || command_args="$command_args -P $pidfile"
eend $?
}