[HOWTO] Unison and your NAS

Share your awesome tips and tricks here.

Moderator: Lillian.W@AST

Post Reply
sksbir
Posts: 395
youtube meble na wymiar Warszawa
Joined: Tue Aug 25, 2015 9:23 pm

[HOWTO] Unison and your NAS

Post by sksbir »

how to run Unison in socket mode on your NAS ( tested with AS5002T ) :

1/ On NAS side :
- get binary here : https://launchpad.net/debian/+source/unison/2.48.3-1
get unison-2.48.3 (for Linux amd-64) --> binary is named "unison-2.48.3_Debian-8"

- Create a folder on your NAS. ( eg : a shared folder in /share.. )
- Create a shell script which contains this :

Code: Select all

#!/bin/sh
UNISON=<folder dedicated to Unison>
export UNISON
cd $UNISON
nohup ./unison-2.48.3_Debian-8 -socket xxxx > unison.log 2>&1 &
Of course, replace <folder dedicated to Unison> with the folder you have created
replace xxxx with socket number . It must be a free port on your NAS. Example : 1299
- make your script executable ( chmod +x... )
- launch it.

2/ on client side ( windows PC )
- get binary here:
http://unison-binaries.inria.fr/ ---> http://www.pps.univ-paris-diderot.fr/~vouillon/unison/
get "unison 2.48.3 - OCaml 4.02.1.zip"
- create a folder dedicated to unison on your PC
- create a cmd script ( run_unison.cmd for example) which contains this:

Code: Select all

@echo off
rem *** retrieve current dir
set UNISON=%~dp0%
rem *** remove trailing "\"
set UNISON=%UNISON:~0,-1%
PATH=%PATH%;%UNISON%\bin\
"%UNISON%\unison 2.48.3 GTK.exe"
- my unison folder contains a subfolder "bin" which contains GTK library. I extracted it from a former version of Gimp. I will post it here if somebody is interested.
I can share a full portable version of Unison

Now, you have to create a sync profile in your local unison folder on PC side. For example : mySYNC.prf , which contains:

Code: Select all

# Unison preferences file
root = <local Folder to sync on your windows PC>
root = socket://<NAS IP or URL>:<port>//share/<sharedFolder>/<remote folder to sync>
times = true
ignorecase = true
fastcheck = true
ignore = Name {Thumbs.db,synctoy*,$RECYCLE.BIN,System Volume Information}
halfduplex = true
you can now launch unison from client side on your PC wich cmd script
Choose the profile you have created
You will get a warning about the fact that there is no archive files. This is normal and unison warns you about the big time it needs to check your replicas the first time.
Archive files are created in the folder located in UNISON variable. This is true for both sides ( client and server side ).


enjoy ! :)
Post Reply

Return to “Tips & Tricks”