Script to sincronize a directory by ssh to a remote computer and watch for changes in any files inside the directory
$ cd ~/directory/to/sincronize
$ ssh-sync -i ~/ssh-key.pem -t /target/remote/directory -o <remote-ip> -u <remote-user>
Install dependencies
# pacman -S coreutils inotify-tools rsync curl
# apt install coreutils inotify-tools rsync curl
Install script
$ curl -s https://raw.githubusercontent.com/PieroNarciso/ssh-sync/main/install.sh | sh
Add this inside .profile
or .bashrc
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
$ rm $HOME/.local/bin/ssh-sync