Simple and straightforward guide for Unison install and set it up to watch changes in folders and start at the boot
sudo apt-get install -y ocaml opam
opam init
git clone https://github.com/bcpierce00/unison.git
cd unison
git checkout 2.48.4
make NATIVE=true UISTYLE=text
sudo install src/unison /usr/local/bin
sudo install src/fsmonitor.py /usr/local/bin
sudo pip install pyinotify
sudo nano /home/[YOUR USER FOLDER NAME]/.unison/profile.prf
Create content:
#Roots of the synchronization
root = /home/folder1
root = /home/folder2
#Paths to synchronize
#Files
path = file1.json
path = file2.json
path = file3.json
#Set files or folders to ignore
ignore = Name filename.txt
#Dirs
path = foldername
#Logging
log = true
logfile = /home/logs/unison-sync-log.txt
# Enable change monitoring for files and folder
auto = true
--------------
sudo nano /lib/systemd/system/unison.service
--------------
[Unit]
Description=unison
After=network.target
[Service]
Type=simple
User=[YOUR USER NAME]
ExecStart=/usr/local/bin/unison profile
StandardOutput=journal
StandardError=journal
Restart=always
RestartSec=0
[Install]
WantedBy=multi-user.target
--------------
sudo systemctl enable unison.service
sudo systemctl daemon-reload
sudo systemctl start unison.service
sudo systemctl stop unison.service
systemctl status unison.service
- More detailed status with live logging view:
journalctl -u unison.service -f
sudo systemctl restart unison.service
sudo systemctl disable unison.service