blob: 219ac4f97c642d61245031460df779ffceb75fc0 (
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
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: milterenma
# REQUIRE: DAEMON
# BEFORE: mail localpkg
# KEYWORD: shutdown
# Define these milterenma_* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
# /etc/rc.conf.d/milterenma
#
# milterenma_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable enma
# milterenma_cfgfile (str): Configuration file.
# milterenma_pid (str): Set pid file path.
# milterenma_uid (str): Set username to run milter.
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
milterenma_enable=${milterenma_enable:-"NO"}
milterenma_cfgfile=${milterenma_cfgfile:-"%%PREFIX%%/etc/enma.conf"}
milterenma_pid=${milterenma_pid:-"/var/run/milterenma/enma.pid"}
milterenma_uid=${milterenma_uid:-"mailnull"}
. /etc/rc.subr
name="milterenma"
rcvar=`set_rcvar`
load_rc_config $name
pidfile=${milterenma_pid}
required_files=${milterenma_cfgfile}
command="%%PREFIX%%/libexec/enma"
command_args="-c ${milterenma_cfgfile}"
start_precmd="enma_precmd"
stop_postcmd="enma_postcmd"
_piddir=$(dirname ${pidfile})
enma_precmd ()
{
if [ ! -d ${_piddir} ] ; then
mkdir -p ${_piddir}
fi
if [ -n "${milterenma_uid}" ] ; then
chown ${milterenma_uid} ${_piddir}
fi
}
enma_postcmd()
{
# just if the directory is empty
rmdir ${_piddir} > /dev/null 2>&1
}
run_rc_command "$1"
|