#!/bin/sh

pid_file="/var/log/antispam/.lock"
spam_check_user="snort"
spam_check_path="/usr/local/etc/postfix/antispam"

case "$1" in
start)
	[ -x $spam_check_path/spam_check.pl ] && su $spam_check_user -c "$spam_check_path/spam_check.pl&"
	echo spam_check
	;;
stop)
	if [ -f $pid_file ]; then
	    pid=`cat $pid_file`
	    kill -1 $pid
	    sleep 1
	    kill $pid
	else 
	    echo "Pid file not found ($pid_file)"
	fi
	;;
*)
	echo "Usage: `basename $0` {start|stop}" >&2
	;;
esac

exit 0

