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?
Asked
Active
Viewed 2,047 times
1 Answers
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