summaryrefslogtreecommitdiff
path: root/watch-calendars
blob: 5b91a011a7c0ddf0fe5a7389468c3bea4ab37c2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

if [ $# -eq 0 ]; then
  find ~/.local/share/khal/calendars \
    -mindepth 1 \
    -maxdepth 1 \
    -type d \
  | parallel -j0 "$0"
  exit $?
fi

while [ -d "$1" ]; do
  inotifywait -r "$1" -e CREATE,MOVED_TO,DELETE -t 30
  git -C "$1" add -A
  git -C "$1" commit -m'update by '"$(whoami)"'@'"$(hostname)"' on '"$(date)"
  git -C "$1" pull --rebase
  git -C "$1" push
done