[afnog] freebsd-script to automate backup
Randy Bush
randy at psg.com
Thu Jul 3 08:50:11 UTC 2008
rdiff-backup looks extremely cool. i run some antique homebrew hacks.
zfs is similar but a bit different.
randy
---
#!/bin/sh
BSYS="raid-array.psg.com"
USYS="backup@$BSYS"
BDIR="/data/backup"
HOST=`hostname -s`
DATE=`date "+%Y-%m-%d"`
DDIR="$BDIR/$HOST.$DATE"
DEST="$USYS:$DDIR"
SSH="/usr/bin/ssh -i /usr/home/backup/.ssh/id_dsa"
# source.psg.com
#
# /dev/mirror/gm0s1a 507630 184968 282052 40% /
# /dev/mirror/gm0s1d 63214 64 58094 0% /root
# /dev/mirror/gm0s1e 1012974 175054 756884 19% /var
# /dev/mirror/gm0s1f 1012974 336758 595180 36% /var/spool
# /dev/mirror/gm0s1g 71055144 18710200 46660534 29% /usr
$SSH $USYS mkdir $DDIR
for F in base var var.spool usr root; do
$SSH $USYS touch $DDIR/$F
done
# 1 - /
/sbin/dump 0Luaf - /dev/mirror/gm0s1a | $SSH $USYS "/bin/cat > $DDIR/base"
# 2 - /root
/sbin/dump 0Luaf - /dev/mirror/gm0s1d | $SSH $USYS "/bin/cat > $DDIR/root"
# 3 - /var
/sbin/dump 0Luaf - /dev/mirror/gm0s1e | $SSH $USYS "/bin/cat > $DDIR/var"
# 4 - /var/spool
/sbin/dump 0Luaf - /dev/mirror/gm0s1f | $SSH $USYS "/bin/cat >
$DDIR/var.spool"
# 5 - /usr
/sbin/dump 0Luaf - /dev/mirror/gm0s1g | $SSH $USYS "/bin/cat > $DDIR/usr"
# -------
More information about the afnog
mailing list