Friday, June 02, 2006

Linux : Synchronizing directories with rdist

rdist is a linux command for keeping identical copies of directories/files over two hosts. File permissions and modification time are preserved if possible. It can use various protocols like ssh, rsh (default). You can have all the synchronization details stored in a file and pass the filename as an argument with option -f to the command as illustrated below.

rdist -f rdist_file

To specify the protocol, use -P option

rdist -P /usr/bin/ssh -f rdist_file

rdist_file is of the following format.

## comments start with '#' sign
/path/on/master/server    ->   remote_server_name  install  /path/on/slave/server ;

-o option is used for specifying an action to be taken on those files on the slave (remote server) which are missing from the master. For truly synchromising two directlries, you can use -oremove to remove the files. The directive then takes the following form.

/path/on/master/server    ->   remote_server_name  install -oremove /path/on/slave/server ;

For more about actions and about the command, see man pages.

No comments: