#!/bin/sh

set -e

if [ -f /etc/conf.d/spamd ]; then
    . /etc/conf.d/spamd
fi
pidfile="${pidfile:-/run/spamd.pid}"

if [ -f "$pidfile" ]; then
	_pid="$(cat "$pidfile")"
fi
/usr/bin/sa-update && R=0 || R=$?
case "$R" in
0)
	;;
1)
	# "No fresh updates were available"; see sa-update(1)
	exit 0
	;;
*)
	exit $R
esac
if [ -n "$_pid" ]; then
	kill -SIGHUP "$_pid"
fi

