Let’s rolling

1
2
3
4
5
yum install ocaml ocaml-camlp4-devel ctags ctags-etags

tar xvfz unison-2.48.4.tar.gz
#Edit src/Makefile.OCaml Replace
CAMLFLAGS+=-g with CAMLFLAGS+=-g -unsafe-string

Install unison

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
cd src
make
#Copy unison binary to /usr/bin
cp unison /usr/bin/
#On the source server create SSH key-pair and copy public key to destination:
ssh-keygen
ssh-copy-id root@destination-ip

#Following tasks are required on source server only: Edit /root/.unison/default.prf
# Roots of the synchronization
root = /var/www
root = ssh://192.168.0.101//var/www

# Paths to synchronize
#path = current
#path = common
#path = .netscape/bookmarks.html

# Some regexps specifying names and paths to ignore
#ignore = Path stats ## ignores /var/www/stats
#ignore = Path stats/* ## ignores /var/www/stats/*
#ignore = Path */stats ## ignores /var/www/somedir/stats, but not /var/www/a/b/c/stats
#ignore = Name *stats ## ignores all files/directories that end with "stats"
#ignore = Name stats* ## ignores all files/directories that begin with "stats"
#ignore = Name *.tmp ## ignores all files with the extension .tmp

auto=true

batch=true

confirmbigdel=true

fastcheck=true
group=true

owner=true


prefer=newer

silent=true

times=true


# set log file
log = true
logfile = /var/log/unison.log

How to use

Just run unison
or you can creating a Cron Job for Unison
run it every 5 mins.

1
*/5 * * * * /usr/bin/unison &> /dev/null

EOF
Enjoy
I, simon love this world ❤️