Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Oct 2004 14:01:08 +0900
From:      Rob <spamrefuse@yahoo.com>
To:        FreeBSD <freebsd-questions@freebsd.org>
Subject:   Re: Backing up a FreeBSD system
Message-ID:  <417C8894.3000704@yahoo.com>
In-Reply-To: <20041024162240.GA11510@saturn.pcs.ms>
References:  <20041018102125.N30190-100000@maily.netdtw.com> <20041024162240.GA11510@saturn.pcs.ms>

next in thread | previous in thread | raw e-mail | index | archive | help
Martin Schweizer wrote:
> Hello Steve
> 
> I copied once a week my filesystems /, /usr and /var to a second hard drive 
> with the following cron batch (it also mailed my the important files, fstab, 
> dmesg.boot and disklabes):
> 
> # Löschen der bestehenden Dateien
> /bin/rm /disk2/backup/*.dmp
> 
> # Dump wird erstellt. Wenn nicht erfolgreich (-> exit codes), 
> # wird ein Mail an your@isp.com versendet
> /sbin/dump -0au -f /disk2/backup/usr_$datum.dmp /usr || /usr/bin/mail -s Backup-Fehler your@isp.com

I see a risk here, in case dump fails: you're left with nothing.
Wouldn't it be better to do it in this order:

  /sbin/dump -0au -f /disk2/safe_backup/usr_$datum.dmp /usr
  <etc. etc.>

  if [ <successful> ]; then
    rm -rf /disk2/backup
    mv /disk2/safe_backup /disk2/backup
  else
    <send error message>
  fi

If the dump fails, you also get the error message, but now
the previous dump backup is still there!

Rob.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?417C8894.3000704>