Being VERY careful while using the --delete option
Henri Shustak
henri.shustak at gmail.com
Thu May 12 15:33:00 MDT 2011
> On UNIX, I am executing an rsync command, from within a script. The command goes something like this:
>
> /usr/bin/rsync --verbose --progress --stats --compress --recursive --times --perms --links --safe-links source_dir/ user at target_machine:/parent_path/source_dir
>
> In other words, I am replicating source_dir on a remote machine. It ends up next to a lot of sibling, directories, like this:
>
> On target_machine
>
> /parent_path/source_dir
> /parent_path/source_dir2
> ....
> /parrent_path/source_dirn
>
> Here's my issue. I'd like to use the --delete option in the command above. However, I wake up in a cold sweat worrying about supplying the empty
> string for source_dir, and thus removing souce_dir, and all it's siblings on target_machine.
>
> Now I realize, I can just be extra careful that the variable pointing to source_string is never empty, but I would like to have other fail safe mechanisms in place.
>
> I hope I have been sufficiently specific to elicit some suggestions. I guess I am looking for the software equivalent of lots of padlocks on the apartment door.
You may wish to consider the use of the -n option. The --dry-run option performs a trial run with no changes made. Using this option will allow you to check what will happen prior to actually moving ahead.
Just a possibility?
---------------------------------------------------------------------
This email is protected by LBackup, an open source backup solution.
http://www.lbackup.org
More information about the rsync
mailing list