- if `ssh $computer "cd $filesystem ;\
- tar cfl - . $forrigecmd \
- --exclude=\"tmp\" \
- --exclude=\".netscape/cache\" \
- --exclude=\"core\" \
- --exclude=\"*.rar\" \
- --exclude=\"*.mp3\" \
- --exclude=\"*.MP3\" \
- --exclude=\"*.iso\" \
- --exclude=\"*.rar\" \
- | gzip" \
- | dd of=$DATE.tmp 2>/dev/null`
- then
- #Det gikk kanskje bra
- mv $DATE.tmp $DATE.tgz
- #lage listefil
- tar tvfz $DATE.tgz > $DATE.idx 2>&1
- grep -v ^d $DATE.idx | sort -n -r +2 > $DATE.sdx
+ #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 $computer "ls ~/.backup/exclude"`
+
+ #We try to run tar on the remote computer
+ # 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 $computer \"$tar --one-file-system -cf - -C $filesystem . $lastcmd \
+ --exclude-from=$exf | gzip\" | (dd of=$TARFILE 2> /dev/null) 2>&1"
+ echo "cmdline: $TARCMD"
+ eval $TARCMD