Unison is a file-syncronization tool. If you need a solution to keep your data up-to-date between two servers, Unison is a great choice.
- Run an automated installation of Unison
- Manage Unison job process profiles
unisonManager has been tested on the Operating System below:
- Ubuntu 22.04
- Debian 11
- Rocky Linux 8
- Oracle Linux 8
To use unisonManager we need to solve some dependencies.
- Python 3
- PIP 3
- PIP packages: paramiko, pyyaml, requests and tabulate
- SSH communication between servers without password
Install Python 3 on Debian-based Linux:
$ apt update && apt install python3 python3-pip -y
Install Python 3 on RedHat-based Linux:
$ yum install python39 python39-pip -y
$ pip3 install paramiko pyyaml requests tabulate
The transfer process uses SSH for communication between servers. So we need to create an SSH key and copy it to remote server.
Create SSH key:
$ ssh-keygen -t rsa # do not put password
Copy the SSH key to the remote server:
ssh-copy-id -i ~/.ssh/id_rsa root@[REMOTE_SERVER_ADDRESS]
The installation process is very simple. You just need to clone this repository and create a symbolic link.
PS: The Unison needs to be installed on all servers!
Clone repo:
$ git clone https://github.com/brisa-dev/unison-manager.git /opt/unisonManager
Create a symbolic link:
$ ln -s /opt/unisonManager/unisonManager.py /usr/local/bin/unisonManager
Install Unison.
Example:
$ unisonManager --install-unison
Add a new Unison job. This option needs to be used with --job-name
, --remote-server
, and --directory
options.
Example:
$ unisonManager --add-job --job-name mysql_files --directory=/data/mysql_files \
--remote-server [REMOTE_SERVER_ADDRESS]
By convention, use the same name to indentify --job-name and --directory.
When process has been finished, all structure necessary to syncronize the data will be created in local and remote server.
Specify a job name when creating a new Unison job.
Specify a directory when creating a new Unison job.
Specify a remote server when creating a new Unison job.
List status of created jobs.
Example:
$ unisonManager --list
Start a Unison job.
Example:
$ unisonManager --start [JOB_NAME]
Stop a Unison job.
Example:
$ unisonManager --stop [JOB_NAME]
Remove a Unison job. PS: This action only removes the Unison profile, it does not remove any data where the data is synced.
Example:
$ unisonManager --remove [JOB_NAME]
This action stops the job process, removes all .unison.tmp and starts job process.
Example:
$ unisonManager --cleanup [JOB_NAME]
This action executes the same of '--cleanup' option, but in all jobs.
Example:
$ unisonManager --cleanup-all
Exports a web data vizualization.
Example:
$ unisonManager --exporter