aports/main/spamassassin/spamd.initd
2026-02-01 13:29:55 +00:00

39 lines
733 B
Bash

#!/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 "Synchronising rules"
/usr/bin/sa-update && R=0 || R=$?
if [ $R -eq 1 ]; then
# "No fresh updates were available"; see sa-update(1)
R=0
fi
eend $R
fi
command_args="-d -r $pidfile $command_args"
}
reload() {
ebegin "Reloading $SVCNAME"
start-stop-daemon --signal=HUP --pidfile $pidfile
eend
}