#!/bin/sh
# Title: full_backup
# Author: B. Alcock <alcockba@boat.bt.com>
# Last updated: Fri 02/01/1998

# Set the path for the script
PATH=/usr/ucb:/usr/bin:/usr/sbin:/usr/local/bin

# Tape device
TAPE_DEV=/dev/rmt/0mb

# Log file
# Set to blank for no logging 
LEVEL1=/var/adm/tape_log
LEVEL2= # /var/adm/tape_log.2

# Which directories/files to backup (relative to /)
BACKUP_DIRS="		\
	bin		\
	etc/[a-z]*	\
	etc/.login	\
	export		\
	home		\
	root		\
	lib		\
	Mail		\
	net		\
	opt		\
	sbin		\
	usr		\
	var		\
	u01 u02 u03 	\
	u04 u05 u06	\
	"

LOGNAME=`whoami`

if [ "$LEVEL1" = "" ] ; then
	LEVEL1=/dev/null
fi

if [ "$LEVEL2" = "" ] ; then
	LEVEL2=/dev/null
fi

echo "$0: started ["`date`"] [user=$LOGNAME]" >>$LEVEL1
cd /
tar cvf $TAPE_DEV $BACKUP_DIRS >>$LEVEL2 2>>$LEVEL1

echo "$0: testing ["`date`"] [user=$LOGNAME]" >>$LEVEL1
if tar tvf $TAPE_DEV >>$LEVEL2 2>>$LEVEL1 ; then
	echo "$0: completed successfully ["`date`"] [user=$LOGNAME]" >>$LEVEL1
	exit 0
else
	echo "$0: error(s) occured on test ["`date`"] [user=$LOGNAME]" >>$LEVEL1
	exit 1
fi    
