aboutsummaryrefslogtreecommitdiff
path: root/mail/opensmtpd-devel/files/smtpd.in
blob: 46fe0be02ed0c7b665b37f4c91eb9939f1dd378f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
#
# $FreeBSD$
#
# 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"