#!/bin/sh
#
# $Id$
# amprintlast -- Print last AMANDA amreport
#
# Usage: amprintlast <config>
#
# Danny Howard <dannyman@toldme.com>

base=/usr/local/etc/amanda

lp="/usr/local/bin/a2ps -q -r --margin=50 --borders=no -f 6 -B -P lp"
amreport="/usr/local/sbin/amreport"
tempfile="/tmp/amanda.report.$$"

config=$1

if [ -d "$base/$config/logs" ]; then
	cd "$base/$config/logs"
else
	echo "$0 <config>"
	echo
	exit
fi

logfile=`ls log.* | sort | tail -1`

$amreport $config -f $tempfile -l $logfile
tr -d '\014' < $tempfile | $lp
