summaryrefslogtreecommitdiff
path: root/mail/py-spf-engine/files/pyspf-milter.in
blob: 2019e2bf129fd94aecc7d4c4acd6f1237d680a89 (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
#!/bin/sh

# PROVIDE: pyspf_milter
# REQUIRE: LOGIN
# BEFORE: mail
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable pyspf_milter:
#
# pyspf_milter_enable (bool)    Set to 'YES' to enable.
#                               Default: NO
# pyspf_milter_conffile (path)  Location of configuration file.
#                               Default: %%PREFIX%%/etc/python-policyd-spf/policyd-spf.conf

. /etc/rc.subr

name=pyspf_milter
rcvar=pyspf_milter_enable

load_rc_config $name

: ${pyspf_milter_enable:=NO}
: ${pyspf_milter_conffile:=%%PREFIX%%/etc/python-policyd-spf/policyd-spf.conf}

command=/usr/sbin/daemon
command_interpreter=%%PYTHON_CMD%%
procname=%%PREFIX%%/bin/pyspf-milter
command_args="-c -f ${procname} ${pyspf_milter_conffile}"
pidfile=%%PYSPF_MILTER_RUNDIR%%/pyspf-milter.pid
required_dirs=%%PYSPF_MILTER_RUNDIR%%
required_files=${pyspf_milter_conffile}
start_precmd=pyspf_milter_cleanup
stop_postcmd=pyspf_milter_cleanup

pyspf_milter_cleanup ()
{
    rm -f ${pidfile}
}

run_rc_command "$1"