[CentOS] rsync question

Mon Sep 7 18:58:00 UTC 2015
Robert Moskowitz <rgm at htt-consult.com>


On 09/07/2015 02:17 PM, Carl E. Hartung wrote:
> On Mon, 7 Sep 2015 13:05:59 -0400
> Robert Moskowitz wrote:
>
>> I am trying to rsync the named files under /etc for backup purposes.
>> I tried:
>>
>> rsync -ah --stats --delete -e "ssh -p613 -l root"
>> 192.168.192.2:/etc/name* /home/rgm/data/htt/httnet/homebase/new/etc
>>
>> The stats shows it sees all the files, but only moves the
>> dir /etc/named and the files within it.
>>
>> It does not move the /etc/name* files (like /etc/named.conf).
>>
>> By file count, it is 'seeing' all the files, but not moving them.
> Hi Robert,
>
> First, a trailing slash specified at the end of the source directory
> means 'copy everything underneath the specified directory without
> copying the directory, itself.' Omitting the trailing slash will cause
> rsync to first create the directory at the target and then copy the
> specified contents underneath it. Your invocation '/etc/name*' probably
> needs to be split into successive command strings, one specifying the
> directory to backup and the other(s) specifying the file(s) under /etc
> that you want to backup, as well.
>
> Also:
>
> Do you really mean '-h' human-readable vs. '-H' preserve hard links?

Yes.

> Why '-e' (specify remote shell to use)? Are these systems running
> disparate operating systems?

Somewhere I read that is what you need to run this over SSH. Otherwise 
you need to have rsyncd running on the remote system.

> I use '-v' so rsync echos what it's doing in real time to the terminal
> as opposed to '--stats', but that's just my personal preference. This
> allows me to monitor what's going on in real time and to scroll up
> afterward to review discreet actions after the fact. There is also the
> '-o' logging capability for those situations where the actions taken
> might exceed the number of lines buffered by the terminal.
>
> Since '--delete' implies that you will be synchronizing the source and
> backup directories in future, you might consider setting up public key
> authentication between the two systems.

This is not an automated system.  It is typically a onetime thing to get 
a backup of what I did to set up a server (or the other way around).  I 
have this adversion of leaving my public key all over the place.

> Since this is a backup, you really should consider preserving ACLs and
> extended attributes (-A -X,) too.

Maybe, but then I can't edit it on my system if it is root:named!

> Given all of the above, with public key authentication set up, you
> could then invoke the following command string from the parent
> directory of the backup (/home/rgm/data/htt/httnet/homebase/new/etc):
>
> rsync -avAX --delete root at 192.168.192.2:/etc/named/ named
> rsync -avAX --delete root at 192.168.192.2:/etc/named.conf named.conf

In /etc there are 4 named.* files.  Do I have to do each separately?

> ... and so on
>
> hth & regards,
>
> Carl
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos
>