问题
I'm wondering if it is safe to use rsync to hotbackup a git server (The /home/git folder containing multiple repositories).
I'm assuming that this could introduce race conditions, but perhaps git commit
is an atomic operation such that rsync either sees the files as they are before the commit or after the commit but not somewhere inbetween.
I'll provide an example as well just to make sure I'm illustrating this properly. Suppose file A and file B are being committed to one of the repositories. Rsync will either back them both up prior to the commit or after the commit. But will not backup file A before the commit, and then file B after the commit.
If using RSync is not safe an alternative would be to run a script that clones each repository to the backup server.
So for the entire server directory: 1) cd into the account 2) clone all repositories 3) cd into next account 4) clone all repositories 5) and so on...
But rsync is a lot simpler so I'm crossing my fingers :). If anyone has an even simpler option I would love to hear about that as well.
TIA, Ole
来源:https://stackoverflow.com/questions/36946527/hotback-of-git-server-using-rsync