# 1 "amdump.sh"






























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

















































































































































































# 31 "amdump.sh" 2

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










































































































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




























































# 32 "amdump.sh" 2

# 1 "../common-src/version.h" 1









































# 33 "amdump.sh" 2



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




suf=


if [ $# -ne 1 ]; then
        echo  Usage: amdump conf
        exit 1
fi

conf=$1
if [ ! -d $confdir/$conf ]; then
    echo "amdump: could not find directory $confdir/$conf"
    exit 1
fi

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

if [ $runuser != $dumpuser ]; then
	echo "amdump: must be run as user $dumpuser"
	exit 1
fi

exec </dev/null >$errfile 2>&1
$execdir/planner$suf | $execdir/driver$suf

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

exit 0
