summaryrefslogtreecommitdiff
path: root/security/amavisd-new/files/amavisd.in
blob: c432e88bf53d4dacedc99c03835ed6a9465e09b1 (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
#!/bin/sh

# PROVIDE: amavisd
# REQUIRE: LOGIN mysql postgresql amavis_p0fanalyzer
# 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

load_rc_config $name

: ${amavisd_enable:=NO}
pidfile=${amavisd_pidfile-"%%AMAVISDIR%%/amavisd.pid"}

command=%%PREFIX%%/sbin/amavisd
command_args='> /dev/null 2>&1'
required_files=%%PREFIX%%/etc/amavisd.conf
extra_commands=reload

start_precmd=start_precmd
stop_postcmd="rm -f $pidfile"
reload_cmd="$command reload"
: ${amavisd_svcj_options:="net_basic"}	# svcjs may be incompatible with amavisd_ram


# 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
	  df %%AMAVISDIR%%/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
}

run_rc_command $1