Mirror and sync one or more remote folders with one or more local folders
Go to file
2021-07-02 17:10:47 +02:00
.gitignore licencing gplv3 2021-06-12 21:48:13 +02:00
.synccmd.sh licencing gplv3 2021-06-12 21:48:13 +02:00
masync syncexists wrong test 2021-06-22 10:49:48 +02:00
README.md README.md 2021-06-17 13:04:22 +02:00
syncloop.sh syncloop 2021-07-02 17:10:47 +02:00

masync

Masync allows you to mirror and keep synchronised an arbitraries number of folders on one or more remote servers with local folders.

dependencies

Masync use inotifywait for listening changes on local folders and keep it in sync with remote folders. Before using it, please install inotify-tools package on your favorite distribution

apt-get install inotify-tools
dnf install inotify-tools
xbps-install -S inotify-tools
...

You must have access to the servers containing the remote folders via ssh and a private key, so

  • install the ssh daemon on your server
  • generate a key pair with ssh-keygen
  • add the public key to the authorised keys on server side
  • edit the ssh config so that you can access with ssh to the server

How to use

Copy files masync, syncloop.sh and .synccmd.sh in ~/bin/

make sure in the .bashrc there is something like this

export PATH=~/bin/:$PATH

Using the command

init

Typical use of tool is starting a sync with the command

masync init -l /home/luca/localsync/ -r remoteuser@server:/home/remoteuser/sync/

-l option stands for the local folder you want to mirror and sync, -r option stands for the remote folder in the form known to both ssh and scp

list

it shows the list of all synched local folders with respective remote folder and some other usefull information: the integer id assigned to the sync, the current status of sync, the local folder you are keeping in sync and the remote folder. In the following commands you can refer the sync to apply the command with the integer id of sync using the option -s, or with the local folder using the option -l

stop

If you want to stop a sync in the list of syncs, you can refer to it either by its id or by the local folder associated with the sync

masync stop -s 1 or masync stop -l /home/luca/localsync/

start

If you want to resume a stopped sync in the list of syncs, you can refer to it either by its id or by the local folder associated with the sync

masync start -s 1 or masync start -l /home/luca/localsync/

remove

Remove the sync from the list of all syncs, do not delete any local folder and data

masync remove -s 1 or masync remove -l /home/luca/localsync/