how to rename remote directory using rsyncd

Matt McCutchen hashproduct+rsync at gmail.com
Mon Jan 8 05:27:24 GMT 2007


On 1/7/07, walterhw at nc.rr.com <walterhw at nc.rr.com> wrote:
> I'm looking for a way to use rsyncd to rename a directory in a module.
> I have worked out how to do everything else in the backup scheme below
> using only the daemon services.  But I can't find a way to do the
> directory rename without using SSH.  I couldn't find anything I could
> use in the archives.
>
> In the backup scheme I'd like to use, each client has a module defined
> on the server.  Daily, each client saves snapshots of itself into a
> directory named for the date the snapshot was taken.  Previous snapshot
> directories then hold copies of only the updated and deleted files.  The
> steps I use are:
> 1) look for the most recent snapshot directory and save the name
> (2007-01-06).
> 2) rename it to the current date (2007-01-07).
> 3) on the client, run "rsync -rt --delete-during --backup
> --backup-dir=2007-01-06 localdir server::2007-01-07".

If you name the most recent snapshot "current" instead of the date it
was taken, you won't need a rename, and the script won't need to do
any looking to access the most recent snapshot.  Or, you might
consider using hard-linked snapshots created with --link-dest instead
of backup directories.

> "rsync --rsync-path='mv 2007-01-06 2007-01-07 && rsync' server:2007-01-07",

You could have the daemon perform the rename as the "pre-xfer exec"
command of the module (see rsyncd.conf(5) for details), which is
conceptually equivalent to what you did with --rsync-path.

Matt


More information about the rsync mailing list