From c82447cf7aa49b0d39e6c06c2637ffcf5b74a8e5 Mon Sep 17 00:00:00 2001 From: Philipp Matthias Schaefer Date: Sat, 16 May 2020 22:23:22 +0200 Subject: [PATCH] Initial commit --- email_text | 19 +++++++++++++++++++ invite.sh | 29 +++++++++++++++++++++++++++++ plenums_invite.service | 6 ++++++ plenums_invite.timer | 8 ++++++++ 4 files changed, 62 insertions(+) create mode 100644 email_text create mode 100755 invite.sh create mode 100644 plenums_invite.service create mode 100644 plenums_invite.timer diff --git a/email_text b/email_text new file mode 100644 index 0000000..4656a6b --- /dev/null +++ b/email_text @@ -0,0 +1,19 @@ +Hallo, + +am PROSEDATE findet wieder ein Plenum statt. Wir treffen uns um 20 Uhr im virtuellen Raum unter + +https://blue.kabi.tk/b/hac-nuf-fp4 + +Das Protokoll wird unter + +https://vereinte.verwirrung.institute/p/ksplenum-URLDATE + +geführt werden. Dieses muss noch auf Basis der Vorlage + +https://vereinte.verwirrung.institute/p/ksplenum-template + +vorbereitet werden (Anleitung dort zu finden). + +Grüße, + +das Einladeskript diff --git a/invite.sh b/invite.sh new file mode 100755 index 0000000..6f1ff8d --- /dev/null +++ b/invite.sh @@ -0,0 +1,29 @@ +#!/usr/bin/bash + +## Configuration + +from="office@krautspace.de" +to="hackspace-jena@lstsrv.org" +subject="Einladung zum Plenum" +body_file=email_text # Use PROSEDATE for dd.mm.YYYY and URLDATE for YYYmmdd + +## Find next Thursday + +day_of_week=$(date +%u) + +next_thursday_offset=$(( ( ( 7 - $day_of_week ) + 4 ) % 7 )) + +## Check if next Thursday is the first of a month + +if (( $(date +%d) > 7 )); then + echo "Invitation should be sent at most a week in advance." + echo "Exiting without sending an inviation..." + exit +fi + +## Send inviation + +prose_date=$(date -d "+$next_thursday_offset days" +%d.%m.%Y) +url_date=$(date -d "+$next_thursday_offset days" +%Y%m%d) + +cat "$body_file" | sed -e "s/PROSEDATE/$prose_date/g" | sed -e "s/URLDATE/$url_date/g" | mail -s "$subject" -r "$from" "$to" diff --git a/plenums_invite.service b/plenums_invite.service new file mode 100644 index 0000000..9d2d5d4 --- /dev/null +++ b/plenums_invite.service @@ -0,0 +1,6 @@ +[Unit] +Description=Send invitation to Hackspace's Plenum + +[Service] +Type=oneshot +ExecStart=/opt/plenums_invite/invite.sh diff --git a/plenums_invite.timer b/plenums_invite.timer new file mode 100644 index 0000000..319509b --- /dev/null +++ b/plenums_invite.timer @@ -0,0 +1,8 @@ +[Unit] +Description=Monthly invite to Hackspace's Plenum + +[Timer] +OnCalendar=Mon 15:00 + +[Install] +WantedBy=timers.target