[CentOS] rsync question

Mon Sep 7 18:17:39 UTC 2015
Carl E. Hartung <carlh04426 at gmail.com>

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?

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

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.

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

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
... and so on

hth & regards,

Carl