--- Karl Hammar <karl(a)aspodata.se> wrote:
Hi,
I use rsync and cron to mirror the /dev/sda array.
Mounted into that array is removable media that
should
not be mirrored. I'm sure someone will see
why
$LABEL
is not being excluded much quicker than I can.
#!/bin/bash
#mirror ~/clients, delete from destination
anything
that doesn't exist at source
#do not mirror removable media; anything other
than
/dev/sda
#kill with ctrl-c, --partial allows resuming of
session
#find scsi device labels
for arg in `ls /dev/sd[b-d][1-16]`
do
echo `/sbin/dumpe2fs -h $arg |grep Filesystem\
volume\ name` > /home/studio/.bin/syncExclude
done
#use sed for character substitution
LABELS=`cat /home/studio/.bin/syncExclude |sed
's/Filesystem volume name:\ //'`
rsync --exclude=$LABELS --rsh=ssh --times --perms
--owner --verbose --progress --compress --delete
--recursive --stats --partial
--temp-dir=/media/mirror/tmp --bwlimit=0
/home/studio/clients/ /media/mirror/clients
Thanks,
Ron
Why don't you simply use -x?
Because that could be to simple and direct. :) Thanks
for the hint.
Actually, I used the LABEL because I'm writing another
script that rsyncs removable media if local and remote
LABEL match. I think it's working. Maybe I'll post
that one up for review too. If you've got time I'd
love to have it torn into.
Thanks,
Ron
$ man rsync 2>/dev/null | grep one-file
-x, --one-file-system don't cross
filesystem boundaries
$
Regards,
/Karl
-----------------------------------------------------------------------
Karl Hammar Aspö Data
karl(a)aspodata.se
Lilla Aspö 2340
Networks
S-742 94 Östhammar +46 173 140 57
Computers
Sweden +46 70 511 97 84
Consulting
-----------------------------------------------------------------------
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com