aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/init/sync.sh
blob: 6dd57ba6011b80d20dd294599674a9073be78e18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

# If git is working in other process, then don't sync again
pidof git >/dev/null && exit 0

# my repo
sync() {
  { cd $1 && [[ -n $(git remote -v) ]] || return; } 2>/dev/null
  git pull --quiet || echo Has trouble when syncing `pwd` >/dev/tty
}
sync $SETTING_DIR &
sync ~/blog &
sync ~/vimwiki &
sync ~/.task &
sync ~/.password-store &
sync ~/.vim_runtime &

while [ $(jobs -r | wc -l) -gt 0 ]; do
  sleep 1;
done

notify-send 'Repos synced'

# others repo
#check_upstream ~/git/tig || echo in `pwd` >/dev/tty &

# thunderbird
#if [[ `cat /etc/hostname` != 'vultr' ]]; then
#  rsync -a pham@topo.tw:~/.thunderbird/ ~/.thunderbird &
#fi