blob: 1190e5fffe28398ca0f83463d141f1dfc1115c7a (
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
55
56
57
58
59
60
61
|
#!/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_daemon.
# mta_sts_config (path): Set path to mta-sts-daemon.yml.
# mta_sts_logfile (path): Set log file name or 'syslog'.
# mta_sts_logverbosity (str): Set log verbosity(debug/info/warning/error/critical)
. /etc/rc.subr
name=mta_sts
rcvar=mta_sts_enable
load_rc_config $name
: ${mta_sts_enable:="NO"}
: ${mta_sts_config:="%%PREFIX%%/etc/mta-sts-daemon.yml"}
: ${mta_sts_user:="mailnull"}
: ${mta_sts_group:="mailnull"}
: ${mta_sts_logfile:="syslog"}
: ${mta_sts_logverbosity:="info"}
pidfile="/var/run/${name}.pid"
command="%%PREFIX%%/bin/mta-sts-daemon"
command_interpreter="%%PYTHON_CMD%%"
start_precmd="${name}_prestart"
start_cmd="${name}_start"
mta_sts_prestart()
{
if [ "$mta_sts_logfile" = "syslog" ]; then
# NOTHING TO DO #
elif touch "$mta_sts_logfile"; then
chown "$mta_sts_user":"$mta_sts_group" "$mta_sts_logfile"
else
err 3 "$mta_sts_logfile: cannot create"
fi
}
mta_sts_start()
{
local logopts=""
local cmdopts="-v $mta_sts_logverbosity"
if [ "$mta_sts_logfile" = "syslog" ]; then
logopts="-S -T mta_sts -l mail -s $mta_sts_logverbosity"
else
cmdopts="$cmdopts -l $mta_sts_logfile"
fi
/usr/sbin/daemon -u "$mta_sts_user" -p "$pidfile" ${logopts} "$command" -c "$mta_sts_config" ${cmdopts}
}
run_rc_command "$1"
|