# 1 "amcleanup.sh"






























# 1 "../config/config.h" 1

















































































































































































# 31 "amcleanup.sh" 2

# 1 "../config/options.h" 1










































































































# 137 "../config/options.h"




























































# 32 "amcleanup.sh" 2



PATH="/usr/local/libexec/amanda"
PATH=$PATH:/usr/ucb:/usr/bin:/usr/sbin:/bin:/sbin
export PATH
confdir="/usr/local/etc/amanda"
execdir="/usr/local/libexec/amanda"




suf=


if [ $# -ne 1 ]
then
        echo "Usage: amcleanup conf"
        exit 1
fi

conf=$1
if [ ! -d $confdir/$conf ]; then
        echo "amcleanup: could not cd into $confdir/$conf"
        exit 1
fi

cd $confdir/$conf
logfile=`getconf$suf logfile`
errfile=`dirname $logfile`/amdump
tapecycle=`getconf$suf tapecycle`

if [ -f $logfile ]; then
	echo "amcleanup: processing outstanding log file."
	exec </dev/null >/dev/null 2>&1
	$execdir/reporter$suf

	
	days=`expr $tapecycle + 2`

	if [ $days -gt 50 ]; then
		days=50
	fi

	while [ $days -ge 2 ]; do
		ndays=`expr $days - 1`
		mv $errfile.$ndays $errfile.$days
		days=$ndays
	done
	mv $errfile $errfile.1

else
	echo "amcleanup: no unprocessed logfile to clean up."
	exit 1
fi

exit 0
