Rdist to a different directory

The more I use rdist the more I like it. I use it to back up the same directory from one server to another (ie /home/htdocs from server1 gets copied over /home/htdocs on server2)

But sometimes it’s nice to be able to backup your files to a different directory, say for example when you are using 1 backup server for several different source servers that might have the same directory structure with different contents. This is no good, because each source server would be overwriting and removing content from the other source servers.

Solution: rdist to different directories. But how?

Just like the first time I set up rdist it took me hours to figure out but is stupidly simple, once you know how! Figuring out how to get ssh to work with no password also took me several hours to figure out, but is also so simple.

So here is the magic – in my distfile templates I have the line
"install -oremove;"
which basically tells the program that anything on the destination that’s not on the source will be deleted (CAREFUL!) so, to this line we simply add the directory path on the destination server. for example
"install -oremove /var/backup1;"
And now rdist will create a new directory tree under /var/backup1 which is a replica of the source directory, in other words from the earlier example, if we back up /home/htdocs with the install line above, the destination server will have /var/backup1/home/htdocs/*MY CONTENTS*

Other directories in the source /home/ folder will not be copied, only the specified htdocs folder.

Here is a full example distfile for rdist’ing to a different destination folder:

HOSTS = ( backup.server.hostname )
FILES = ( /home/htdocs/ )
${FILES} -> ${HOSTS}
except /home/htdocs/excluded_dir;
install -oremove /var/backup1;

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *