]> git.sesse.net Git - backup.sh/commitdiff
Less forks!
authorroot <empty>
Thu, 26 Jul 2007 13:47:07 +0000 (13:47 +0000)
committerroot <empty>
Thu, 26 Jul 2007 13:47:07 +0000 (13:47 +0000)
-berge

backup.sh

index e39cade4655560d67dd23dcd0eb8350004d333d2..5bbf1378b09c83cf736881e59926fd752b5d1f02 100755 (executable)
--- a/backup.sh
+++ b/backup.sh
@@ -100,6 +100,7 @@ backup()
  exf=`ssh $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)
@@ -110,18 +111,11 @@ backup()
  #    ..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"
+ TARCMD="ssh $computer \"$tar --one-file-system -zcf - -C $filesystem . $lastcmd \
+       --exclude-from=$exf\" > $TARFILE"
  echo "cmdline: $TARCMD"
- eval $TARCMD
-
- # Ideally, we should check wether the tar command returned 0 or not, but it
- # seems a pipe in bash returns the value of the last command in the pipe.
- # Instead, we check wether the resulting file has zero size, in which case we
- # consider it an error.
- if [ -s $TARFILE ]; then
-  echo `date`": command probably ran without errors."
-  #perhaps it did work
+
+ if eval $TARCMD; then
   mv $TARFILE $DATE.tgz
   #make a filelist.
   #update the datefile if the filelist is ok.