1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-22 04:17:44 +00:00
freebsd-ports/mail/opensmtpd/files/smtpd.in
2021-04-06 16:31:13 +02:00

53 lines
1.2 KiB
Bash

#!/bin/sh
# PROVIDE: smtpd mail
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable smtpd:
# smtpd_enable (bool): Set it to "YES" to enable OpenSMTPD.
# Default is "NO".
# smtpd_config (string): Path to OpenSMTPD configuration file.
# Default is "%%PREFIX%%/etc/mail/smtpd.conf"
# smtpd_flags (string): Additional flags to be passed to smtpd.
# Default is "".
#
#
. /etc/rc.subr
name="smtpd"
rcvar=smtpd_enable
start_precmd="smtpd_precmd"
restart_precmd="smtpd_checkconfig"
configtest_cmd="smtpd_checkconfig"
extra_commands="configtest"
load_rc_config $name
: ${smtpd_enable:="NO"}
: ${smtpd_config:="%%PREFIX%%/etc/mail/${name}.conf"}
: ${smtpd_procname:="%%PREFIX%%/sbin/${name}"}
: ${smtpd_flags:=""}
command=${smtpd_procname}
command_args="-f ${smtpd_config} ${command_args}"
required_files="${smtpd_config}"
procname=${smtpd_procname}
pidfile="/var/run/${name}.pid"
smtpd_checkconfig()
{
echo "Performing sanity check on smtpd configuration:"
eval ${command} ${command_args} ${smtpd_flags} -n
}
smtpd_precmd()
{
smtpd_checkconfig
}
run_rc_command "$1"