Skip to content

Instantly share code, notes, and snippets.

@zaxo7
Created April 27, 2023 13:25
Show Gist options
  • Save zaxo7/c267cb632edaa7482068e9ea21d532be to your computer and use it in GitHub Desktop.
Save zaxo7/c267cb632edaa7482068e9ea21d532be to your computer and use it in GitHub Desktop.
a script to continiously sync directories between two hosts
#in this example i am trying to sync my current directory to the /var/www on the remote
#note: to avoid typing password at each time i suggest enabling public key authentification by ssh-copy-id root@host
#i use this setup when working in embedded devices it makes life easier
while true; do
inotifywait -r . -e modify,create,delete
rsync -avzz --exclude 'sync.sh' --delete --update . root@192.168.1.1:/var/www/
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment