Monitors a local directory for changes and syncs them to a remote machine via SSH using rsync. It works on unix based systems, including Macintosh.
The script will check for the existence of a config file (i.e. .watchsyncrc.sh) for setting default settings. Once default settings have been confirmed or overridden, the script continues watching and syncing until you close it. An SSH connection is made each time changes are detected, files are synced, and the connection is closed.
The following packages are required.
- rsync
- sshpass
- inotify-tools (linux only)
- fswatch (macintosh only)
Make watch-sync.sh executable, run it, then respond to the prompts. This may look like the following.
chmod +x watch-sync.sh # Make it executable
./watch-sync.sh # Run it.Default options can be configured as variables at the top of the script or by adding the .watchsyncrc.sh file to the directory where you will be running watch-sync.sh.