4

I need to keep my code synchronized with the same code on virtual machine. Is there a way to monitor file changes and automatically call rsync or something like that?

Ivan Ivanov
  • 2,042
  • 1
  • 19
  • 28

1 Answers1

5

Create a shell script that would call inotifywait then rsync in a loop, something like:

#!/bin/bash
LOCAL="/path/to/local/dir"
RSYNC_OPTIONS=...
while true
do
    inotifywait -r $LOCAL
    rsync $RSYNC_OPTIONS
done

inotifywait is part of the inotify-tools package under Ubuntu

Silas Parker
  • 8,017
  • 1
  • 28
  • 43