ReSync (REpository SYNChronizer) is a small utility used to continuously and unilaterally synchronize a master machine (typically a coding machine) with slaves machines (build or execution machines) in real time.
The name come from the original usage (synchronize a git repository from a
coding machine to a build/execution machine) and is a word play with rsync
.
Install the requirements for Debian-based system:
sudo apt-get install rsync inotify-tools
Install the requirements for Arch Linux system:
sudo pacman -S rsync inotify-tools
Configure the system by increasing the inotify’s watches for a user, otherwise,
the Couldn't initialize inotify: Too many open files
error could happened:
sudo make configure
Install it in normal mode:
sudo make install
Install it in development mode:
sudo make install-dev
Uninstall it:
sudo make uninstall
Call the script with:
- The repository path as first argument,
- The machines’ SSH names as second (and more) argument(s).
resync $pwd $hostname
The repository will be continuously synchronized to the SSH machine, in a git
folder under its home directory ($REMOTE:$HOME/git
), using inotify
as
change detection system and rsync
as transfer system.
Regarding the current installation method, resync.sh
has to remain a
single-file project for now.
Use a system-wide lock file (e.g. touch /tmp/resync-$(pwd)
or using a
symlink) during all resync
process to not allow launching 2 resync
processes in the same git project.
Use a repository-wide lock file (e.g. touch .git/.resync-lock
) during
rsync
process to allows launching resync
on two machines for the same repo,
allowing to do duplex synchronization.