diff options
Diffstat (limited to 'bin/init/sync.sh')
-rwxr-xr-x | bin/init/sync.sh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/bin/init/sync.sh b/bin/init/sync.sh new file mode 100755 index 0000000..bcd7bed --- /dev/null +++ b/bin/init/sync.sh | |||
@@ -0,0 +1,37 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # If git is working in other process, then don't sync again | ||
4 | pidof git >/dev/null && exit 0 | ||
5 | |||
6 | # my repo | ||
7 | sync() { | ||
8 | { | ||
9 | cd $1 && [[ -n `git remote -v` ]] || return | ||
10 | } 2>/dev/null | ||
11 | GIT_SSH_COMMAND="ssh -o ControlMaster=no" git pull --quiet || echo Has trouble when syncing `pwd` | ||
12 | } | ||
13 | sync $SETTING_DIR & | ||
14 | sync ~/log & | ||
15 | sync ~/blog & | ||
16 | sync ~/git/vps & | ||
17 | sync ~/.task & | ||
18 | sync ~/.password-store & | ||
19 | sync ~/.vim/vim-init & | ||
20 | sync ~/bean & | ||
21 | |||
22 | while true; do | ||
23 | if test $(jobs -r | wc -l) -gt 0; then | ||
24 | sleep 1; | ||
25 | else | ||
26 | which notify-send &>/dev/null && notify-send 'Repos synced' | ||
27 | break | ||
28 | fi | ||
29 | done & | ||
30 | |||
31 | # others repo | ||
32 | #check_upstream ~/git/tig || echo in `pwd` >/dev/tty & | ||
33 | |||
34 | # thunderbird | ||
35 | #if [[ `cat /etc/hostname` != 'vultr' ]]; then | ||
36 | # rsync -a pham@topo.tw:~/.thunderbird/ ~/.thunderbird & | ||
37 | #fi | ||