[linux-audio-user] OT: another rsync script, reviews please

R Parker rtp405 at yahoo.com
Fri Jul 28 00:31:23 EDT 2006


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 at studioagig ls /dev/sd[b-d][1-16]`
do
   echo `ssh root at 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
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 at studioagig:/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 



More information about the Linux-audio-user mailing list