#!/bin/sh
#
# $NetBSD: spampd.sh,v 1.1 2025/03/03 14:51:59 jakllsch Exp $
#

# PROVIDE: spampd
# BEFORE: mail
# REQUIRE: DAEMON LOGIN

. /etc/rc.subr

name="spampd"
rcvar=$name
pidfile="/var/run/${name}/${name}.pid"
command_interpreter="/usr/pkg/bin/perl"
command="/usr/pkg/sbin/spampd"
command_args="-p ${pidfile} -u _spampd -g _spampd"
extra_commands="reload"
start_precmd="spampd_prestart"

spampd_prestart()
{
	if [ ! -d "/var/run/${name}" ]; then
		/bin/mkdir -p "/var/run/${name}"
		/bin/chmod 775 "/var/run/${name}"
		/usr/sbin/chown _spampd:_spampd "/var/run/${name}"
	fi
}

load_rc_config $name
run_rc_command "$1"
