2021-06-14 21:31:43 +02:00
|
|
|
# masync
|
|
|
|
|
2021-06-14 21:46:38 +02:00
|
|
|
Masync allows you to mirror and keep synchronised an arbitraries number of folders on one or more remote servers with local folders.
|
|
|
|
|
2021-06-14 22:24:32 +02:00
|
|
|
## dependencies
|
2021-06-14 21:46:38 +02:00
|
|
|
|
|
|
|
Masync use inotifywait for listening changes on local folders and keep it in sync with remote folders.
|
2021-06-14 22:24:32 +02:00
|
|
|
Before using it, please install **inotify-tools** package on your favorite distribution
|
2021-06-14 21:54:16 +02:00
|
|
|
|
2021-06-14 21:58:29 +02:00
|
|
|
```
|
2021-06-14 21:54:16 +02:00
|
|
|
apt-get install inotify-tools
|
|
|
|
dnf install inotify-tools
|
|
|
|
xbps-install -S inotify-tools
|
2021-06-14 21:58:29 +02:00
|
|
|
...
|
|
|
|
```
|
2021-06-14 21:46:38 +02:00
|
|
|
|
2021-06-14 22:24:32 +02:00
|
|
|
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
|
|
|
|
|
2021-06-16 22:00:36 +02:00
|
|
|
## 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`
|
|
|
|
|
2021-06-16 22:10:16 +02:00
|
|
|
## 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
|
|
|
|
|
2021-06-17 13:04:22 +02:00
|
|
|
`masync start -s 1 or masync start -l /home/luca/localsync/`
|
2021-06-16 22:10:16 +02:00
|
|
|
|
|
|
|
###### 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/`
|
|
|
|
|