#!/bin/bash
#
# ruleuse - check local SA rule usage
#
# Copyright 2009, Martin Gregorie.
#
# This file is part of the Spamkiller package.
#
# Spamkiller is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# Spamkiller is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Foobar.  If not, see <http://www.gnu.org/licenses/>.              
# 
if [ "$1" == '-?' ]
then
	echo "Syntax:   ruleuse [options]"
	echo "Function: Runs spamscan against all mail logs to determine" 
	echo "          which locally defined Spamassassin rules are active"
	echo "          and which are unused. By default the -unused option"
	echo "          is set, but if options are supplied on the command"
	echo "          line -unused will be omitted."
	echo "Options:  Same as spamscan options."
	exit
fi
args="$*"
if [ -z "$args" ]
then
   args='-unused'
fi
cat /var/log/maillog* | spamscan $args

