Linux: one way remote sync using unison and ssh

PHOTO EMBED

Mon Aug 29 2022 14:03:56 GMT+0000 (Coordinated Universal Time)

Saved by @marcopinero #bash

#install unison

$ sudo apt install unison

# synchronizing from local folder "/home/user/sync/" with remote "ssh://user@remotehost.com/" folder "/home/user/sync/" (ssh port 22000)


$ unison -silent -auto -batch /home/user/sync/ ssh://user@remotehost.com//home/user/sync/ \
  -nodeletion ssh://user@remotehost.com//home/user/sync/ \
  -sshargs '-p22000' -logfile /tmp/mylog.txt
content_copyCOPY

This procedure makes a file synchronization between local folder and remote ssh folder. options: -silent: no messages -auto: auto sync -batch: no asking -nodeletion <folder>: Avoid deletion of files at folder <folder> when synchronizing -sshargs '-p22000': use 22000 as ssh port -logfile: file for log output.