- #Prøver å ta backup med tar
- if `ssh $computer "cd $filesystem ;\
- tar cfl - . $forrigecmd \
- --exclude-from=/tmp/.backup/exclude \
- | gzip" \
- | dd of=$DATE.tmp 2>/dev/null`
- then
- #perhaps it did work
- mv $DATE.tmp $DATE.tgz
- #make a filelist and update the datefile
+ #if this client has a special tar
+ #we need to find a better solution to this conf-issue
+ if [ -f $confdir/tar.$computer ] ; then
+ tar=`cat $confdir/tar.$computer`
+ else
+ tar=tar
+ fi
+
+ #expand the exclude-path for use with tar
+ exf=`ssh root@$computer "ls ~/.backup/exclude"`
+
+ #We try to run tar on the remote computer
+ # z gzip it
+ # c create archive
+ # C change to directory first
+ # - output to stdout (we pipe to gzip, then to dd)
+ # . where to start taring (see C)
+ # $lastcmd only files newer than this
+ # --exclude-from file to get exclusion pattern from
+ # pipe to gzip, which in turn pipes over the ssh-stream
+ # ..to dd, to output to a file. We surpress messages from dd.
+ # And at last, redirect stderr to stdout, to get output logged.
+ TARFILE=$DATE.tmp
+ TARCMD="ssh root@$computer \"$tar --one-file-system -zcf - -C $filesystem . $lastcmd \
+ --exclude-from=$exf\" > $TARFILE"
+ echo `date`" $computer: Running $TARCMD" >&2
+
+ if eval $TARCMD; then
+ mv $TARFILE $DATE.tgz
+ #make a filelist.
+ #update the datefile if the filelist is ok.