rsync was Re: [lug] ssh compression
Hugh Brown
hugh at vecna.com
Tue May 7 08:22:29 MDT 2002
Thanks to all those who contributed. Peter suggested I do a backup of
the stuff that I rsync over. I get to be able to restore to a given
point in time and I don't get killed on the bandwidth.
This is what I have right now for the rsync part:
#!/bin/bash
# make the filesystem writable
/bin/mount -o remount,rw /backup
# Tell rsync to use ssh as the transfer mechanism
RSYNC_RSH=/usr/bin/ssh
export RSYNC_RSH=/usr/bin/ssh
# List of dirs on dst-host to backup
BACKUP_DIRS="/var/named /etc /var/spool/mail /home"
# rsync only likes one directory at a time
for DIR in $BACKUP_DIRS; do
/usr/bin/rsync --verbose \
--backup-dir /backup/rsync/dst-host.bak \
--update \
--stats \
--bwlimit=16 \
--relative \
--archive \
--compress \
--delete \
dst-host:${DIR} \
/backup/rsync/dst-host/
done
# Make sure all data has been written out and then remount
# the filesystem read-only
/bin/sync;/bin/sync;/bin/sync
/bin/umount /backup
# fsck gripes about how often the filesystem is mounted
/sbin/fsck -a /dev/hdc1
/bin/mount /backup
/bin/date
Am I doing anything obviously stupid?
I want the host that I run the script from just to copy down what's on
dst-host. I never want it to delete anything on dst-host, but if
something disappears on dst-host, I want it to be deleted on the
src-host.
Also, my isp's bandwidth limit is 128kbps. The --bwlimit is in Kbytes.
Am I right in setting it at 16 because 128k bit/s * (1 byte/8 bit) = 16
Kbytes/s.
Thanks again for all the help.
Hugh
More information about the LUG
mailing list