Automatic synchronization via rsync [closed]

2019-05-12 01:02发布

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?

标签: sync rsync
1条回答
家丑人穷心不美
2楼-- · 2019-05-12 01:19

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

查看更多
登录 后发表回答