Listing 5: fullbak.sh / fullbakp.sh (linked)
#
# fullbak.sh/fullbakp.sh (linked):
# Make full backup of a filesystem, compressed or otherwise.
# Always put in currently selected dataset (i.e., don't seek).
#
# Create a logfile named Full_<filesystem> in the CTARDIR directory
#
# usage: fullbak.sh <filesystem> (NO compression)
# fullbakp.sh <filesystem> (WITH COMPRESSION)
#
# examples (note: do NOT use leading slash!):
# fullbak.sh u1
# fullbakp.sh u4
#
ROOT=/
CTARDIR=/u3/Backup/Logs; export CTARDIR
ADMIN=admin # user/alias to send mail to in case of error
if [ `basename $0` = fullbakp.sh ]; then
OPTIONS=c8VMP # compression
else
OPTIONS=c8VM # no compression
fi
[ $# -ne 1 ] && echo "usage: $0 <filesystem>" && exit 1
CTARFILE=$CTARDIR/Full_$1; export CTARFILE
cd $ROOT
if [ $1 != root ]; then
cd $1 # if not root, do entire filesystem
nice -19 ctar $OPTIONS .
else # if root, do all except /u, /u[1-5]:
nice -19 ctar ${OPTIONS}EEEEEE /u /u1 /u2 /u3 /u4 /u5 .
fi
if [ $? -ne 0 ]; then
/usr/bin/mail -s "ctar error" $ADMIN <<END
There was an error performing a full backup. Please check the log file
(it is in /u3/Backup/Logs/LAST_Master).
END
fi
ctar T8 >>$CTARFILE.true 2>&1
|