From c389677306ee37c53ecbd3a6a8476ebd58e8f00e Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 21 Jan 2020 14:46:54 +0100 Subject: watch-calendars new --- watch-calendars | 25 +++++++++++++++++++++++++ watch-calendars.service | 9 +++++++++ 2 files changed, 34 insertions(+) create mode 100755 watch-calendars create mode 100644 watch-calendars.service 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 diff --git a/watch-calendars.service b/watch-calendars.service new file mode 100644 index 0000000..a985c22 --- /dev/null +++ b/watch-calendars.service @@ -0,0 +1,9 @@ +[Unit] +Description=watch khal calendars + +[Service] +User=erich +ExecStart=/usr/src/skripte/khal-extras/watch-calendars + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3-70-g09d2