#!/bin/sh # # $FreeBSD: head/mail/opensmtpd/files/smtpd.in 378922 2015-02-13 11:52:22Z ashish $ # # 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 check_process() { /bin/pgrep -j none -f 'smtpd: \[priv\]' } 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/smtpd.conf"} : ${smtpd_procname:="%%PREFIX%%/sbin/smtpd"} : ${smtpd_flags:=""} command=${smtpd_procname} procname=${smtpd_procname} smtpd_checkconfig() { echo "Performing sanity check on smtpd configuration:" eval ${command} ${smtpd_flags} -n } smtpd_precmd() { smtpd_checkconfig } run_rc_command "$1"