Backing up a FreeBSD system
Rob
spamrefuse at yahoo.com
Sun Oct 24 22:01:12 PDT 2004
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 at isp.com versendet
> /sbin/dump -0au -f /disk2/backup/usr_$datum.dmp /usr || /usr/bin/mail -s Backup-Fehler your at 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.
More information about the freebsd-questions
mailing list