summaryrefslogtreecommitdiff
path: root/watch-calendars
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-01-21 14:46:54 +0100
committerErich Eckner <git@eckner.net>2020-01-21 14:46:54 +0100
commitc389677306ee37c53ecbd3a6a8476ebd58e8f00e (patch)
tree36378f3fb63153e55bb2d4279afb3dc3b9c64b80 /watch-calendars
parent338cfac97dee09619c18a262fdf517d6b1cf6e01 (diff)
downloadkhal-extras-c389677306ee37c53ecbd3a6a8476ebd58e8f00e.tar.xz
watch-calendars new
Diffstat (limited to 'watch-calendars')
-rwxr-xr-xwatch-calendars25
1 files changed, 25 insertions, 0 deletions
diff --git a/watch-calendars b/watch-calendars
new file mode 100755
index 0000000..5f89051
--- /dev/null
+++ b/watch-calendars
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+if [ $# -eq 0 ]; then
+ find ~/.local/share/khal/calendars \
+ -type d \
+ -mindepth 1 \
+ -maxdepth 1 \
+ -exec "$0" {} \;
+ exit $?
+fi
+
+dir=$(
+ readlink -e "$1"
+)
+
+cd "${dir}" || exit $?
+
+while [ -d "${dir}" ]; do
+ inotifywait -r . -e CREATE,MOVED_TO -t 30
+ if [ $? -eq 0 ]; then
+ git commit -am'update by '"$(whoami)"'@'"$(hostname)"' on '"$(date)"
+ fi
+ git pull --rebase
+ git push
+done