aboutsummaryrefslogtreecommitdiffstats
path: root/main/spamassassin/spamd.initd
blob: 7967cffe777786228723f7895a622c97e969c3a9 (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
#!/sbin/openrc-run

pidfile=${pidfile:-/run/spamd.pid}
command=/usr/sbin/spamd
command_args="${command_args:--m 5 -c -H}"
extra_started_commands="reload"

depend() {
	need net
	before mta
	use logger
}

_legacy() {
	[ -n "$PIDFILE" ] && pidfile=$PIDFILE
	[ -n "$SPAMD_OPTS" ] && command_args=$SPAMD_OPTS
}

start_pre() {
	_legacy
	required_dirs="/var/lib/spamassassin/3.004001"
	if [ ! -d $required_dirs ]; then
		ebegin "Downloading rules"
		/usr/bin/sa-update
		eend $?
	fi
	command_args="-d -r $pidfile $command_args"
}

reload() {
	ebegin "Reloading $SVCNAME"
	start-stop-daemon --signal=HUP --pidfile $pidfile
	eend
}