Bi-directional Sync: Unison

Bi-directional Sync: Unison

The Unison file synchronizer, with repository at bcpierce00/unison is a highly reliable cross-platform tool that comes with a decent GUI out of the box and it supports both local folder synchronization and remote synchronization, effectively covering both areas: cross-folder and cross-device synchronization. Iako podržava continuous sync, ne uključuje se iz UI već se mora čačkati po config fajlovima. Specifičnosti za MacOS Unison Wiki | Main / UnisonFAQOSSpecific

Running Unison

Kao prvo, moram da pronađem gde se nalazi “profile” konfiguracioni fajl:

1
2
find . -name Treasury.prf
# ~/Library/Application Support/Unison/Treasury.prf

Ako ne želim da koristim profile fajl, mogu da kucam i unison -batch dir1 dir2

Zatim u profile fajl trba dodati neke parametre:

ignore = Name .git

auto=true

batch=true
silent=false

confirmbigdel=true
fastcheck=true
owner=true
group=true
prefer=newer
times=true

Ignore patterns can also be specified on the command line using an option like -ignore 'Name .git'

I pokreni Unison sa tim profilom:

1
unison Treasury -batch -silent -ui text

Scheduling the sync

Avoid multiple unison processes running and launch unison only if it is not currently running, and do all that in the crontab -e a pre toga možeš promeniti crontab editor sa export VISUAL=nano

1
2
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
*/5  * * * * pgrep unison >/dev/null || unison Treasury -batch -silent -ui text >/dev/null

How to run your script on a schedule using crontab on macOS: A step-by-step guide | by Justin Ng | Medium

How to schedule tasks with crontab on macOS · GeekBitZone.com - Passionate About Tech

Jedini izvor informacija mi je bio tekst Sync your data with Unison. How to use Unison to keep your data in… | by Martín Lamas | Trabe | Medium

If needed, we can sync only in one direction

One-way sync odnosno clone odnosno mirror odnosno backup se postiže upotrebom parametra -force gde navodiš koji je root od ona dva taj koji treba da bude finalni na oba mesta.


software recommendation - What are good bi-directional, real-time synchronization utilities between Mac local folder and web server? - Ask Different Configure unison for continuous sync File Synchronization with Unison A journey from Unison to Syncthing and back to Unison

Mutagen tutorial: syncing files easily with a remote server | PhotoRoom

Na osnovu Unison, neko je kreirao Mutagen na repo mutagen-io/mutagen: Fast file synchronization and network forwarding for remote development, koji se pretvorio u kompaniju koju je sredinom 2023 kupio Docker, a u pitanju je two-way file synchronization ali pored toga oni nude i network forwarding. Mutagen je stvarno cross-platform i na macOS se instalira sa brew kao na Installation | Mutagen a za razliku od Unison, lako ga je pokrenuti kao daemon. Nekolicina UI helper toolova se može pronađi na repo.

Performance - DDEV Docs

Fast file synchronization and network forwarding for remote development | Hacker News

Software for syncing internal and external hard drives – Matias Kinnunen

synchronization - How to get Lsyncd’s file-watching capability with Unison’s two-way sync? - Stack Overflow

Vinh Q. Nguyen - Real time file synchronization like Dropbox via Unison


deajan/osync: A robust two way (bidirectional) file sync script based on rsync with fault tolerance, POSIX ACL support, time control and near realtime sync


Kod Unison je interesantno da za remote sync osim remote ssh methoda podržava i manje siguran TCP Sockets metod, što je interesantan pristup.

Unison Manual at unison-manual.txt

Some command-line arguments, like -ui, are expected to appear on the command-line only, not in a profile.

date 28. Dec 2023 | modified 10. Jun 2024
filename: Cloud Storage » Personal » Unison