#!/bin/sh
#
# $NetBSD: denyhosts.sh,v 1.2 2011/10/07 22:37:06 shattered Exp $
#
# PROVIDE: denyhosts
# REQUIRE: DAEMON
#
# You will need to set some variables in /etc/rc.conf to start denyhosts:
#
# denyhosts=YES

if [ -f /etc/rc.subr ]
then
	. /etc/rc.subr
fi

name="denyhosts"
rcvar=$name
command=/usr/pkg/bin/denyhosts.py
command_interpreter=/usr/pkg/bin/python3.12
command_args="--config /usr/pkg/etc/denyhosts.conf --daemon"
pidfile=/var/run/denyhosts.pid
required_files=/usr/pkg/etc/denyhosts.conf

if [ ! -f /etc/hosts.deny ]; then
	touch /etc/hosts.deny
fi

if [ -f /etc/rc.subr ]; then
	load_rc_config $name
	run_rc_command "$1"
else
	echo -n " ${name}"
	exec ${command} ${command_args}
fi
