Automatic synchronization via rsync [closed]

笑着哭i 提交于 2019-12-07 15:53:59

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/8165259/automatic-synchronization-via-rsync

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!