blob: 488c02ee0ba9a010665bbededc6056534c25f719 (
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
62
63
64
65
|
#!/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"}
. %%RC_SUBR%%
name="milterenma"
rcvar=`set_rcvar`
load_rc_config $name
if [ -f "${milterenma_cfgfile}" ];then
milterenma_cfgfile="-c ${milterenma_cfgfile}"
else
echo "milterenma_cfgfile is not correctly set"
exit 1
fi
pidfile=${milterenma_pid}
command="%%PREFIX%%/bin/enma"
command_args="${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"
|