From: Paul Eggert Date: Thu, 1 Nov 1990 19:11:07 +0000 (+0000) Subject: Initial revision X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=a30037e51535b7c748361c72785a63157dd13226;p=chaz%2Ftar Initial revision --- a30037e51535b7c748361c72785a63157dd13226 diff --git a/scripts/weekly.new b/scripts/weekly.new new file mode 100755 index 0000000..d3e87df --- /dev/null +++ b/scripts/weekly.new @@ -0,0 +1,42 @@ +#!/bin/sh +# start doing things +TOBACKUP="albert:/" + +HOST=`hostname | sed 's/\..*//'` +TAPEFILE=/dev/rfd0a +LOGFILE=tar-out +BLOCKING=20 +TAR_PART1="/usr/local/bin/tar clbfVM $BLOCKING" + +rm -f $LOGFILE + +mt -f $TAPEFILE rewind + + host=`echo $TOBACKUP | sed 's/:.*$//'`; + fs=`echo $TOBACKUP | sed 's/^.*://'`; + date=`date`; + fsname=`echo $TOBACKUP | sed 's/\//:/g'` + + TAR_PART2="'Weekly backup of $fs on $host at $date' -C $fs ." + echo Backing up $TOBACKUP at $date | tee -a $LOGFILE + + # Actually back things up. + + if [ $HOST != $host ] ; then + rsh $host $TAR_PART1 $HOST:$TAPEFILE $TAR_PART2 + else + sh -c "exec $TAR_PART1 $TAPEFILE $TAR_PART2" + fi + if [ $? -ne 0 ] ; then + echo Backup of $TOBACKUP failed. | tee -a $LOGFILE + echo mts at time of failure | tee -a $LOGFILE + mts -t $TAPEFILE | tee -a $LOGFILE + # I'm assuming that the tar will have written an empty + # file to the tape, otherwise I should do a cat here. + else + echo $date > $fsname.lasttar + fi + sleep 60; + +mt -f $TAPEFILE rewind +mt -f $TAPEFILE offl