[Tutorial] How to use unison for replication, synchronization folder for Ubuntu
Unison is a file-synchronization tool for Unix and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other
Replication folder /tmp/srv238 (on 192.168.2.238) <-> /tmp/srv239 (on 192.168.2.239) (master-master) with user: super.
S1. Setup login ssh without password
- Create public key and private key in ssh client:
ssh-keygen -t dsa- Copy public key from client to ssh server:
ssh-copy-id -i ~/.ssh/id_dsa super@webserver2S2. Config file Unison, auto answer request
sudo nano /home/super/.unison/default.prfEdit file
root = /tmp/server238S3. Start
root = ssh://192.168.2.239//tmp/server239
auto=true
batch=true
Manual start:
unison defaultAuto start every 1 minute:
crontab -eand add line:
1 * * * * unison defaultS4. Log
tail -f /home/super/.ssh/unison.log