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

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

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