Hi *,
The following script uses rsync over LAN to mirror a
raid1 array. If anyone has a better method for
performing the task, I'd be interested in knowing
about it or my method is OK but the script could use
some improvements, etc. Please don't be sensetive with
your comments. I really like having my ass handed to
me.The problem with rsync mirror occurs when the source
is lost and rsync mirrors nothing. The mirror is
supposed to be a backup. I'll read the rsync man page
but maybe someone knows an appropriate solution.#!/bin/bash
#rsync; mirror studioagig:~/clients/$remLABEL (remote
removable media) /media/clients/$locLABEL (local) if
device LABELs match
#write labels with /sbin/tune2fs -L fsb /dev/sda1
#root priveleges are required to run dumpe2fs#find label for remote scsi device
for arg in `ssh root@studioagig ls /dev/sd[b-d][1-16]`
do
echo `ssh root@studioagig /sbin/dumpe2fs -h $arg
|grep Filesystem\ volume\ name` >
~/.bin/RemoteSyncInclude
done#find label for local mirror device
for arg in `ls /dev/sd[a-f][1-16]`
do
echo `/sbin/dumpe2fs -h $arg |grep Filesystem\
volume\ name` > ~/.bin/LocalSyncInclude
doneremLABEL=`cat ~/.bin/RemoteSyncExclude |sed
's/Filesystem volume name:\ //'`
locLABEL=`cat ~/.bin/LocalSyncExclude |sed
's/Filesystem volume name:\ //'`if [ "$remLABEL" == "$locLABEL" ]; then
rsync --rsh=ssh --times --perms --owner --compress
--delete --recursive --partial --temp-dir=/tmp
--bwlimit=0
studio@studioagig:/home/studio/clients/$remLABEL/
/media/clients
fi
exitThanks,
Ron
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
LINUX® is a registered trademark of Linus Torvalds in the USA and other countries.
Linuxaudio.org logo copyright Thorsten Wilms © 2006.
Hosting provided by the Virginia Tech Department of Music and DISIS.