It is currently Tue Jan 19, 2021 5:00 am
All times are UTC + 8 hours

[HOWTO] Unison and your NAS

Share your awesome tips and tricks here.

[HOWTO] Unison and your NAS

Postby sksbir » Sun Dec 27, 2015 11:42 pm

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 ! :)
sksbir
 
Posts: 339
Joined: Tue Aug 25, 2015 9:23 pm

Return to Tips & Tricks

  • You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot post attachments in this forum
  • Who is online

    Users browsing this forum: No registered users and 3 guests