[CentOS] an rsync question

Les Mikesell lesmikesell at gmail.com
Wed Feb 27 16:54:41 UTC 2013


On Wed, Feb 27, 2013 at 10:34 AM,  <m.roth at 5-cent.us> wrote:
> Is there any way to have rsync compare against a file with a *different*
> name?
>
> What I'd like to do is compare a vm - whatsit.img against a backup -
> whatsit.current, that's a symlink to whatsit.timestamp, and if different,
> *then* make the copy (which my script will then move to
> whatsit.newtimestamp, and change the symlink to point to the new one, then
> remove the old (or maybe save an older copy or two).
>
> So:
> backupdir
>   \ whatsit.20130101 (backup of whatsit.img)
>     whatsit.current -> whatsit.20130101
>     whatsit.20121201
>
> After script w/ rsync
> backupdir
>   \ whatsit.20130201 (backup of whatsit.img)
>     whatsit.current -> whatsit.20130201
>     whatsit.20130101

I don't think you can do it with symlinks (maybe with -L??), but a
hard link with the same name should work.  Normally rsync builds a new
copy and renames it to the old name only after completion so any other
link names should keep the old data (unlike programs that would
overwrite the existing data).   Or just let rsync do all the work
itself with the --backup-dir option.  With that, if the target differs
it will update it and move a copy of the outdated version into the
specified directory.

-- 
   Les Mikesell
     lesmikesell at gmail.com



More information about the CentOS mailing list