Re: OT: rsync mirror, scripting question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 25, 2006 at 01:27:09PM -0700, R Parker 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
                  ^^^^^^^
Probably need to throw some double quotes around there.
WHen in doubt, replace your command with an echo of the command
and do a trial run...
i can usually spot my shell issues quickly that way.

-- 

Paul Winkler
http://www.slinkp.com

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux