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@email-addr-hidden ls /dev/sd[b-d][1-16]`
do
echo `ssh root@email-addr-hidden /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
done
remLABEL=`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@email-addr-hidden:/home/studio/clients/$remLABEL/
/media/clients
fi
exit
Thanks,
Ron
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Received on Fri Jul 28 12:15:07 2006
This archive was generated by hypermail 2.1.8 : Fri Jul 28 2006 - 12:15:07 EEST