#!/bin/sh

# PROVIDE: archivesmtp
# REQUIRE: DAEMON
# BEFORE: mail
# KEYWORD: shutdown

. /etc/rc.subr

name="archivesmtp"
desc="Achive SMTP Milter Daemon"
rcvar="archivesmtp_enable"

# Read settings and set defaults
load_rc_config "$name"

: ${archivesmtp_enable:="NO"}
: ${archivesmtp_chuser:="nobody"}
: ${archivesmtp_socket:="unix:%%SOCKETBASE%%/%%SOCKETDIR%%/mta.sock"}
: ${archivesmtp_config:="%%PREFIX%%/etc/archivesmtp.conf"}
: ${archivesmtp_pidfile:="%%SOCKETBASE%%/%%SOCKETDIR%%/run.pid"}
# archivesmtp_flags= May be used to set optional behaviours.
command="%%PREFIX%%/sbin/${name}"
pidfile="${archivesmtp_pidfile}"
command_args="-p ${archivesmtp_socket} -f ${archivesmtp_config} -u ${archivesmtp_chuser} -r ${archivesmtp_pidfile} ${archivesmtp_flags} &"

run_rc_command "$1"
