FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 12-08-2007, 11:21 PM
Steven Vishoot
 
Default OT: Rsync question

Hello All,

I have an off topic question about rsync and was
wondering if i can get some kind person help with it.
I have two servers with each server have three same
directories on them /dir1/ /dir2/ /dir3/ . How would i
achieve this by using rsync?
I have tried rsync -avrt --delete server_ip:/dir1/
/dir2/ /dir3/ /dir1/ /dir2/ /dir3/
this does not do anything except give errors.

Someone on IRC suggested i do a loop something like
this,
for i in "/dir1/ /dir2/ /dir3/"; do rsync -av
$i root@server:${i};done
but when i do it i do not get what i was expecting and
also receive errors about not able to transfer files.


I am not able to post the exact errors since it has
been a while since i have attempted this and do not
wish to screw stuff up right at the moment, but in
general both say rsync cannot transfer files.

So in general is there a way i can do multiple
directories in one command or am i left with doing
them each individual as in rsync -av server:/dir1/
/dir1/
and repeat for the rest of directories. or does
someone know of a better way. my final goal is to have
a cronjob do this.

thanks

steven

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-08-2007, 11:54 PM
"Jeff Larsen"
 
Default OT: Rsync question

On Dec 8, 2007 6:21 PM, Steven Vishoot <sir_funzone@yahoo.com> wrote:
> So in general is there a way i can do multiple
> directories in one command or am i left with doing
> them each individual as in rsync -av server:/dir1/
> /dir1/
> and repeat for the rest of directories. or does
> someone know of a better way. my final goal is to have
> a cronjob do this.

Look at the --include-from and --exclude-from options in the rsync man
page and then read the section further down that explains the format
for include/exclude files. Generally, you can use the --exclude-from
option to set up both includes and excludes by using + and - notation
in your pattern file.

So your pattern file might be something like:

+ /dir1
+ /dir2
+ /dir3
- **

You'll have to play with it some. I use this technique to do a
selective rsync of the CentOS repository for local yum access.

Although, there's no reason the ' for i in /dir1 /dir2 /dir3'
shouldn't work. Start debugging your script without the loop, just
rsync /dir1 and get that working, then add more.

Jeff
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-09-2007, 06:23 PM
Bill Campbell
 
Default OT: Rsync question

On Sat, Dec 08, 2007, Steven Vishoot wrote:
>Hello All,
>
>I have an off topic question about rsync and was
>wondering if i can get some kind person help with it.
>I have two servers with each server have three same
>directories on them /dir1/ /dir2/ /dir3/ . How would i
>achieve this by using rsync?
>I have tried rsync -avrt --delete server_ip:/dir1/
>/dir2/ /dir3/ /dir1/ /dir2/ /dir3/
>this does not do anything except give errors.
>

I usually set up an rsync module on the remote system allowing
writes, and restricting access to the IP address of the machine
initiating the backups. Say this is backups_upd. Then I'll do
something like:

cd /
for dir in dir*; do
rsync --delete -axr $dir destmachine::backups_upd/$dir
done

The section of the rsyncd.conf file might look like this:

[backups_upd]
list = no
uid = root
gid = root
read only = false
use chroot = false
path = /backups
comment = /backups
hosts allow = 192.168.0.0/16
hosts deny = *

Bill
--
INTERNET: bill@celestial.com Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way
FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676

It is practically impossible to teach good programming style to
students that have had prior exposure to BASIC: as potential
programmers they are mentally mutilated beyond hope of
regeneration. -- Dijkstra
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 12-11-2007, 12:30 AM
Steven Vishoot
 
Default OT: Rsync question

--- Jeff Larsen <jlar310@gmail.com> wrote:

> On Dec 8, 2007 6:21 PM, Steven Vishoot
> <sir_funzone@yahoo.com> wrote:
> > So in general is there a way i can do multiple
> > directories in one command or am i left with doing
> > them each individual as in rsync -av server:/dir1/
> > /dir1/
> > and repeat for the rest of directories. or does
> > someone know of a better way. my final goal is to
> have
> > a cronjob do this.
>
> Look at the --include-from and --exclude-from
> options in the rsync man
> page and then read the section further down that
> explains the format
> for include/exclude files. Generally, you can use
> the --exclude-from
> option to set up both includes and excludes by using
> + and - notation
> in your pattern file.
>
> So your pattern file might be something like:
>
> + /dir1
> + /dir2
> + /dir3
> - **
>
> You'll have to play with it some. I use this
> technique to do a
> selective rsync of the CentOS repository for local
> yum access.
>
> Although, there's no reason the ' for i in /dir1
> /dir2 /dir3'
> shouldn't work. Start debugging your script without
> the loop, just
> rsync /dir1 and get that working, then add more.
>
> Jeff
> _______________________________________________
> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos
>
Jeff,

thank you for your suggestion, I will investigate this more.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 04:43 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org