#!/bin/sh

# $FreeBSD: ports/dns/gdnsd/files/gdnsd.in,v 1.2 2012/11/17 05:57:09 svnexp Exp $
#
# PROVIDE: gdnsd
# REQUIRE: DAEMON
# REQUIRE: LOGIN
# KEYWORD: FreeBSD shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# gdnsd_enable (bool):	Set to NO by default.
#				Set it to YES to enable gdnsd.
# gdnsd_config (path):	Set to /usr/local/etc/gdnsd/config
#				by default.

. /etc/rc.subr

name="gdnsd"
rcvar=`set_rcvar`
command="/usr/local/sbin/gdnsd"

# set defaults
load_rc_config $name
: ${gdnsd_enable:="NO"}
: ${gdnsd_config="/usr/local/etc/gdnsd/config"}
: ${gdnsd_pidfile="/usr/local/var/run/gdnsd.pid"}

required_files=${gdnsd_config}
command_args="-c ${gdnsd_config} start"
procname=${command}
extra_commands="checkconf"
checkconf_cmd="gdnsd_checkconf"

stop_postcmd=stop_postcmd

stop_postcmd()
{
  rm -f ${gdnsd_pidfile}
}

gdnsd_checkconf()
{
  ${command} -c ${gdnsd_config} checkconf
}

run_rc_command "$1"

