summaryrefslogtreecommitdiffstats
path: root/mail/milter-bogom/files/milter-bogom.in
blob: 233fe78cb9dfacc971aa24f6f6ec739d3c80460d (plain)
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
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: milterbogom
# REQUIRE: LOGIN
# BEFORE: sendmail
# KEYWORD: milterbogom

. /etc/rc.subr

name=milterbogom
rcvar=milterbogom_enable
command=%%PREFIX%%/sbin/bogom
start_precmd="bogom_precmd"
stop_postcmd="bogom_postcmd"

load_rc_config $name

milterbogom_enable=${milterbogom_enable-"NO"}
milterbogom_socket=${milterbogom_socket-"unix:/var/run/bogom/milter.sock"}
milterbogom_user=${milterbogom_user-"mailnull"}
milterbogom_pid=${milterbogom_pid-"/var/run/bogom/bogom.pid"}
milterbogom_flags=${milterbogom_flags-"-u ${milterbogom_user} \
-s ${milterbogom_socket} -p ${milterbogom_pid}"}

pidfile=${milterbogom_pid}

bogom_precmd()
{
    if [ ! -d `dirname ${milterbogom_pid}` ]
    then
    	mkdir -p `dirname ${milterbogom_pid}`
    fi
    chown ${milterbogom_user} `dirname ${milterbogom_pid}`
}

bogom_postcmd()
{
    # just if the directory is empty
    rmdir `dirname ${milterbogom_pid}` > /dev/null 2>&1
}
run_rc_command "$1"
OpenPOWER on IntegriCloud