blob: 67a97f76ef57381f534f5e5443f07c3531b5b881 (
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: amavisd
# REQUIRE: LOGIN mysql postgresql
# BEFORE: mail
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable amavisd:
#
#amavisd_enable="YES"
#
. /etc/rc.subr
name=amavisd
rcvar=amavisd_enable
command=%%PREFIX%%/sbin/amavisd
command_args='> /dev/null 2>&1'
required_files=%%PREFIX%%/etc/amavisd.conf
extra_commands="reload"
start_precmd=start_precmd
# possible values include: amavisd_ram="512m"
# adds ram disk for amavisd defanging/decoding, speeds up large systems 10%
start_precmd()
{
rm -rf %%AMAVISDIR%%/tmp/* %%AMAVISDIR%%/tmp/.* 2>/dev/null || true
if [ ${amavisd_ram} ];then
echo "========================================================"
echo "WARNING: using ramdisk is reported to be unstable and"
echo "thus it is highly recommended to be turned off."
echo "========================================================"
df /var/amavis/tmp | grep -E '^(/dev/md|tmpfs)' > /dev/null
if [ $? -eq 1 ]; then
mdmfs -s ${amavisd_ram} -p 750 -w %%AMAVISUSER%%:%%AMAVISGROUP%% md %%AMAVISDIR%%/tmp || true
fi
fi
}
stop_postcmd=stop_postcmd
stop_postcmd()
{
rm -f $pidfile
}
reload_cmd=${name}_reload
amavisd_reload()
{
${command} reload
}
# set defaults
amavisd_enable=${amavisd_enable:-"NO"}
amavisd_pidfile=${amavisd_pidfile:-"%%AMAVISDIR%%/amavisd.pid"}
load_rc_config $name
run_rc_command "$1"
|