5 HOST=`hostname | sed 's/\..*//'`
9 TAR_PART1="/usr/local/bin/tar clbfVM $BLOCKING"
13 mt -f $TAPEFILE rewind
15 host=`echo $TOBACKUP | sed 's/:.*$//'`;
16 fs=`echo $TOBACKUP | sed 's/^.*://'`;
18 fsname=`echo $TOBACKUP | sed 's/\//:/g'`
20 TAR_PART2="'Weekly backup of $fs on $host at $date' -C $fs ."
21 echo Backing up $TOBACKUP at $date | tee -a $LOGFILE
23 # Actually back things up.
25 if [ $HOST != $host ] ; then
26 rsh $host $TAR_PART1 $HOST:$TAPEFILE $TAR_PART2
28 sh -c "exec $TAR_PART1 $TAPEFILE $TAR_PART2"
30 if [ $? -ne 0 ] ; then
31 echo Backup of $TOBACKUP failed. | tee -a $LOGFILE
32 echo mts at time of failure | tee -a $LOGFILE
33 mts -t $TAPEFILE | tee -a $LOGFILE
34 # I'm assuming that the tar will have written an empty
35 # file to the tape, otherwise I should do a cat here.
37 echo $date > $fsname.lasttar
41 mt -f $TAPEFILE rewind