The only thing root gets emailed is the log file which is where I find the error message "error fsf'ing tape". As far as the size is concerned, the total amount going onto a single tape each night would not normally exceed 10 GB. I'll post the script in fragments. I think it'll take 5 posts. Here goes.
hostdump.sh:
#!/bin/sh
#
#
###################################################################
#
# Rcs_ID="$RCSfile: hostdump.sh,v $"
# Rcs_ID="$Revision: 1.34 $ $Date: 2000/12/14 09:36:05 $"
#
# Authors: Curtis Preston
# (Inspired by a script written by Andrew Blair that backed up Ultrix systems.)
#
###################################################################
#
BINDIR="CHANGEME"
if [ "$BINDIR" = "CHANGEME" ] ; then
echo "You must change the value of BINDIR in $0 to the name"
echo "of the directory where you installed $0 and accompanying"
echo "scripts."
fi
Usage()
{
[ "$DEBUG" = Y ] && set -x
echo "
Usage: $SCRIPT level device log_file system_list
Where:
level = Valid dump level (e.g. 0-9)
device = NO REWIND Tape Drive (e.g. /dev/rmt/0cn)
OR, a directory to backup to (e.g. a removable zip disk)
log_file = FULL Pathname of log file for this backup
system_list = List of systems or file systems to back up
Examples:
$SCRIPT 0 /dev/rmt/0n /tmp/backup/log apollo elvis bambi
$SCRIPT 0 /zipdrive/backupdir /tmp/backup/log apollo elvis bambi
You can give just a list of system names to $SCRIPT. If you do do this,
this script will automatically backup all filesystems on the systems that
you list, excluding any that you list in a file called /etc/\$FSTAB.exclude.
(Where \$FSTAB is the name of the fstab file for that platform. For example,
on Solaris you would have an /etc/vfstab.exclude.)
$SCRIPT 0 /dev/rmt/0n /tmp/backup/log apollo:/ apollo:/usr elvis:/ bambi:/
If you list the file systems one by one, as in the second option above,
it will backup ONLY those filesystems that you list."
}
Log_err()
{
[ "$DEBUG" = Y ] && set -x
#This function determines the success of a previous command, and performs
#the following actions: Puts the error in a log that will be mailed and in
#the master log for this session, and exits the script after running the mail
#function (if the third argument is "exit").
STATUS=$1 ; ERR_MESS=$2
if [ $STATUS -gt 0 ] ; then
echo
echo "$ERR_MESS" >> $TMP/$X.MAIL.LOG
[ -n "$LOG" ] && echo "$ERR_MESS" >> $LOG
if [ "$3" = exit ] ; then
Mail_logs
exit 1
fi
fi
}
Mail_logs()
{
[ "$DEBUG" = Y ] && set -x
#The only thing that is put in the MAIL.LOG is errors, so if there are
#any, then mail them with notification
if [ -s $TMP/$X.MAIL.LOG ] ; then
echo
echo "Backup error message from $SERVER, trying to do a backup." \
|tee $TMP/$X.MAIL.TMP
echo "$SCRIPT received these arguments: $ARGS" | tee -a $TMP/$X.MAIL.TMP
cat $TMP/$X.MAIL.LOG | tee -a $TMP/$X.MAIL.TMP
cat $TMP/$X.MAIL.TMP | $L_MAIL $L_S "Backup_Status" $ADMINS
else
if [ -n "$SUCCESSMAIL" ] ; then
echo "The following backup completed with no errors:" >$TMP/$X.MAIL.TMP
echo "$SCRIPT $ARGS" >> $TMP/$X.MAIL.TMP
cat $TMP/$X.MAIL.TMP | $L_MAIL $L_S "Backup_Status" $ADMINS
fi
fi
[ -n "$TMP/$X*" ] && rm -f $TMP/$X.* $TMP/BACKUP.LABEL
}
Check_fs_type()
{
[ "$DEBUG" = Y ] && set -x
case $REMOTE_OSnR in
*aix* )
#This awk line is required to turn the multi-line, stanza format
#of aix's /etc/filesystems into a single-line variable
FSTYPE=`$RSH_IF_REMOTE $CLIENT_IF_REMOTE $R_CAT $FSTAB |grep -v '^\*' \
|awk '$0 ~ /^\/.*:/ { printf $0 } $0 ~ /vfs.*=/ { print $0 }' \
|sed 's/ //g' \
|sed 's/[ ][ ]*vfs[ ][ ]*=[ ][ ]*//' \
|grep "^/" |egrep -v ':cdrfs|:nfs|/tmp:' \
|grep "$FILE_SYS:"|awk -F: '{print $2}'`
;;
*bsdi*|*dgux*|*freebsd*|*next*|*osf*|*irix*|*ultrix*|*sunos*|*convex*|*linux*)
FSTYPE=`$RSH_IF_REMOTE $CLIENT_IF_REMOTE $R_CAT $FSTAB | egrep -v '^#|:' \
| egrep "^/|#.*advfs" |grep -v '#.*#.*advfs' |awk '{ print $2":"$3 }' \
| egrep -v ':swap|:nfs|

roc|:iso9660|:nucfs|:dos|:cd*fs' \
| egrep -v ':rfs|:tmp|:hsfs|:swapfs|:ignore|

rocf*s*'\
| egrep -v '

cfs|:dos|:msdos|/tmp:|^\(.*\):' \
|grep "$FILE_SYS:"|awk -F: '{print $2}'`
;;
*hpux9* )
FSTYPE=`$RSH_IF_REMOTE $CLIENT_IF_REMOTE $R_CAT $FSTAB | egrep -v '^#|:' \
| grep "^/" |awk '{ print $2":"$3 }' \
| egrep -v ':swapf*s*|:nfs|

roc|:cdfs|:ignore' \
| egrep -v '/tmp:|^\(.*\):' \
|grep "$FILE_SYS:"|awk -F: '{print $2}'`
;;
*hpux10* )
FSTYPE=`$RSH_IF_REMOTE $CLIENT_IF_REMOTE $R_CAT $FSTAB | egrep -v '^#|:' \
| grep "^/" |awk '{ print $2":"$3 }' \
| egrep -vi ':swapf*s*|:nfs|:ignore|:cdfs|:nfs' \
| egrep -v '/tmp:|^\(.*\):' \
|grep "$FILE_SYS:"|awk -F: '{print $2}'`
;;
*sysv4*)
FSTYPE=`$RSH_IF_REMOTE $CLIENT_IF_REMOTE $R_CAT $FSTAB | egrep -v '^#|:' \
| grep "^/" | awk '{ print $3":"$4 }' \
| egrep -v ':swap|:nfs|

rocf*s*' \
| egrep -v '/tmp:|/dev/fd:|/dev/dsk/f' \
|grep "$FILE_SYS:"|awk -F: '{print $2}'`
;;
*sco* )
#This awk line is required because sco's fstab can go over multiple lines
#each ending with a '\' until the last line. This turns them into
#one line, then chops out the extraneous data
FSTYPE=`$RSH_IF_REMOTE $CLIENT_IF_REMOTE $R_CAT $FSTAB |egrep -v '^#|:' \
|awk '$NF ~ /\\/ { printf $0 } $NF !~ /\\/ { print $0 }' \
|sed 's/.*mountdir=//'|sed 's/[ ].*fstyp=/:/' \
|sed 's/[ ].*//'egrep -vi ':HS|

OS' \
|grep "$FILE_SYS:"|awk -F: '{print $2}'`
;;
*solaris* )
FSTYPE=`$RSH_IF_REMOTE $CLIENT_IF_REMOTE $R_CAT $FSTAB | egrep -vi ':|^#' \
|grep '^/' |awk '{ print $3":"$4 }' \
|egrep -v ':swap|:nfs|:hsfs|

roc|-:|/tmp:|/dev/fd:' \
|grep "$FILE_SYS:"|awk -F: '{print $2}'`
;;
esac
[ -n "$FSTYPE" ] || FSTYPE=unk
}
Check_if_client_is_remote()
{
[ "$DEBUG" = Y ] && set -x
if [ $CLIENT = $SERVER ] ; then
RSH_IF_REMOTE=
CLIENT_IF_REMOTE=
else
RSH_IF_REMOTE=$L_RSH
CLIENT_IF_REMOTE=$CLIENT
fi
export RSH_IF_REMOTE CLIENT_IF_REMOTE
}
#Essential variables, that are needed even if we bomb out...
if [ ! -f $BINDIR/hostdump.sh ] ; then
echo "There is a variable called BINDIR in this script, and it is"
echo "either NOT set, or is set to the incorrect value."
echo "Please edit $0 and set it to the name of the directory in which"
echo "you installed this script."
exit 1
fi
L_MAIL=mail
L_S=''
MESS=''
export BINDIR L_MAIL L_S MESS
#Set this variable to Y to turn on set -x for all functions
DEBUG=N
[ "$DEBUG" = Y ] && set -x
#config.guess is the GNU platform guessing script. Check to make sure it's there
if [ ! -f ${BINDIR}/config.guess -o ! -x ${BINDIR}/config.guess ] ; then
Log_err $? "${BINDIR}/config.guess is missing or not executable!
You may need to change the BINDIR variable in $0 to where you placed
config.guess and $0.
You may also need to set it's executable bit (chmod 755 config.guess)." exit
fi
#If you want to TRY to back up IRIX xfs file systems via the xfsdump program,
#Set the following variable to "YES." Warning: Your mileage may vary
#significantly backing up to other OS's, but it can work. If you have
#ANY problems, just change this variable to NO (the default), and
#it will default back to cpio for xfs file systems
XFSDUMP=YES
SERVER=`uname -n 2>/dev/null|awk -F'.' '{print $1}'`
#If it doesn't return anything, try hostname
[ -n "$SERVER" ] || SERVER=`hostname|awk -F'.' '{print $1}'`
#Use config.guess to get OS-n-Revision (OSnR)
LOCAL_OSnR=`${BINDIR}/config.guess`
export LOCAL_OSnR
#List of id's to be mailed upon success or failure
ADMINS="root"
#Will only mail on error if SUCCESSMAIL set to no
SUCCESSMAIL=no
SCRIPT=`basename $0`
X=$$
ARGS=$*
TMP=/usr/tmp
DAY=`date +"%a"`
TMPDF=$TMP/$X.$SERVER
DEVSHORT=`echo $2|sed 's-/--g'`
export LOCAL_OSnR ADMINS SUCCESSMAIL SCRIPT X ARGS TMP DAY TMPDF DEVSHORT
#Most systems don't add much performance after a 64k blocking factor
#So I have hard-coded it to be 64. Feel free to change it, but make
#sure you test it, to make sure you OS can write AND READ at the B_FACTOR
B_FACTOR=64
TMPLIST="$TMP/$X.$SCRIPT.$SERVER.$DEVSHORT.tmp.list"
INCLIST="$TMP/$X.$SCRIPT.$SERVER.$DEVSHORT.list"
export B_FACTOR TMPLIST INCLIST
cp /dev/null $TMPLIST
Log_err $? "Could not create $TMPLIST" exit
cp /dev/null $INCLIST
Log_err $? "Could not create $INCLIST" exit
##############################################################
PATH=/bin:/usr/bin:/etc:/bin:/usr/ucb:/usr/sbin:/sbin:/usr/bsd:/usr/local/bin
export PATH
#Check for -h flag asking for help on command
if [ "$1" = -h ] ; then
Usage ; exit
fi
ARGNUM=$#
LEVEL=$1
DEVICE=$2
LOG=$3
[ $ARGNUM -gt 3 ] && shift 3 #This will leave a list of clients
CLIENTS="$*"
. ${BINDIR}/localpath.sh
#Check for sufficient number of arguments
if [ $ARGNUM -lt 4 ] ; then
Usage ; Log_err 1 "$SCRIPT (Missing arguments!): $ARGS" exit
fi
# validate the arguments
#
if [ $LEVEL -gt 9 -o $LEVEL -lt 0 ] ; then
Log_err 1 "Invalid level for $DUMP (Should be 0-9): $LEVEL" exit
fi
TAPE=Y #Set default value of TAPE to Y, unless the DEVICE changes it
if [ ! -c $DEVICE ] ; then
#If it's not a character device, then it must be a directory
if [ -d $DEVICE ] ; then
#If the backup device that you've specified is a directory, then backup to disk
TAPE=N
DEVICE_BASE=$DEVICE/hostdumps
[ -d $DEVICE_BASE ] || mkdir $DEVICE_BASE
else
#If it's not a directory, and it's not a character device, it's not right!
Log_err 1 "Invalid device (Not a character device or a directory): $DEVICE" exit
fi
fi
cp /dev/null $LOG
Log_err $? "Could not create output file: $LOG" exit