simonthum / git-sync

Safe and simple one-script git synchronization
773 stars 99 forks source link

Perpetual mode? #12

Closed krlmlr closed 5 years ago

krlmlr commented 5 years ago

Would you support something like

nohup git sync --perpetual

? I'd like to run it in an environment where I don't have screen or inotify tools, so watch or #9 are not an option. Thanks for considering, happy to contribute.

simonthum commented 5 years ago

In principle that can be done with the check and sync modes, i.e. calling git-sync from an an outside script which fits your needs.

I'd rather include in git-sync what may be missing to support that use case than to include such a mode directly. However, if there is a genuine advantage to including it in git-sync I'm open to it.

Just start coding and then let's see what option is better.

krlmlr commented 5 years ago

For this use case it's also important to kill it. I'll experiment a bit and perhaps come back.

edrex commented 5 years ago

@krlmlr if you are on a systemd linux you could use systemd user units, check out https://github.com/edrex/dotfiles/blob/master/.config/systemd/user/git-sync%40.path (and the corresponding service) as an example. That example monitors for new commits to the current branch, so for this script you'd want to change the path to your repo root. I use it for auto-pushing my Zim wiki.

I'm in the process of porting that wiki to vimwiki and I'm considering using this git-sync script, in which case I'll update the systemd units and link them.