#!/bin/sh

# PROVIDE: mta_sts
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add these lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# mta_sts_enable (bool):	Set to NO by default.
# 		     		Set it to YES to enable mta_sts.
# mta_sts_config (path):	Set to /usr/local/etc/mta-sts-daemon.yml
#				by default.

. /etc/rc.subr

name=mta_sts
rcvar=mta_sts_enable

load_rc_config $name

: ${mta_sts_enable:="NO"}
: ${mta_sts_config="/usr/local/etc/mta-sts-daemon.yml"}
: ${mta_sts_user="nobody"}

pidfile=/var/run/${name}.pid
command=/usr/local/bin/mta-sts-daemon
command_interpreter="/usr/local/bin/python3.9"

start_cmd="${name}_start"

mta_sts_start()
{
	/usr/sbin/daemon -u "${mta_sts_user}" -p "${pidfile}" "${command}" -c "${mta_sts_config}"
}

run_rc_command "$1"
