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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: A list for linux audio users <linux-audio-user@...>
Date: Friday, July 28, 2006 - 4:31 am

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
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@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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[linux-audio-user] OT: another rsync script, reviews please, R Parker, (Fri Jul 28, 4:31 am)