Add invite.ics attachment (fix #2)
```mail```-Aufruf und Zeitplanung ist nicht getestet
This commit is contained in:
parent
2fd20b18f6
commit
5ad9de1c6d
3 changed files with 54 additions and 8 deletions
30
invite.ics
Normal file
30
invite.ics
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
BEGIN:VCALENDAR
|
||||||
|
PRODID:-//KrautSpace Jena//KrautSpace Einladescript//DE
|
||||||
|
VERSION:2.0
|
||||||
|
CALSCALE:GREGORIAN
|
||||||
|
METHOD:REQUEST
|
||||||
|
BEGIN:VEVENT
|
||||||
|
DTSTART:#DTSTART#
|
||||||
|
DTEND:#DTEND#
|
||||||
|
DTSTAMP:#DTSTAMP#
|
||||||
|
UID:#DTSTAMP#@kraut.space
|
||||||
|
SUMMARY:#SUMMARY#
|
||||||
|
DESCRIPTION:Wir treffen uns um 20 Uhr im virtuellen Raum unter:
|
||||||
|
\n\nhttps://blue.kabi.tk/b/hac-nuf-fp4
|
||||||
|
\n\nFür Vorbereitung und Protokoll gibt es wieder ein Pad,
|
||||||
|
bitte tragt schon mal Themen ein, die Ihr gern besprechen würdet:
|
||||||
|
\n\nhttps://vereinte.verwirrung.institute/p/ksplenum-#URLDATE#
|
||||||
|
\n\n\nGgf. muss das Pad erst noch vorbereitet werden,
|
||||||
|
die Vorlage mit Anleitung findet Ihr hier:
|
||||||
|
\n\nhttps://vereinte.verwirrung.institute/p/ksplenum-template
|
||||||
|
LOCATION:#LOCATION#
|
||||||
|
ORGANIZER;CN=KrautSpace Jena;
|
||||||
|
SENT-BY="MAILTO:#FROM#"
|
||||||
|
:mailto:#REPLY_TO#
|
||||||
|
SEQUENCE:0
|
||||||
|
STATUS:CONFIRMED
|
||||||
|
CLASS:PUBLIC
|
||||||
|
CATEGORIES:MEETING
|
||||||
|
TRANSP:OPAQUE
|
||||||
|
END:VEVENT
|
||||||
|
END:VCALENDAR
|
30
invite.sh
30
invite.sh
|
@ -4,18 +4,17 @@
|
||||||
|
|
||||||
from="office@krautspace.de"
|
from="office@krautspace.de"
|
||||||
to=("hackspace-jena@lstsrv.org" "krautspace-announce@lstsrv.org")
|
to=("hackspace-jena@lstsrv.org" "krautspace-announce@lstsrv.org")
|
||||||
|
replyto="hackspace-jena@lstsrv.org"
|
||||||
subject="Einladung zum Plenum"
|
subject="Einladung zum Plenum"
|
||||||
|
location_url="https://blue.kabi.tk/b/hac-nuf-fp4"
|
||||||
body_file=email_text # Use PROSEDATE for dd.mm.YYYY and URLDATE for YYYmmdd
|
body_file=email_text # Use PROSEDATE for dd.mm.YYYY and URLDATE for YYYmmdd
|
||||||
|
|
||||||
## Find next Thursday
|
## Find next Thursday
|
||||||
|
date_fmt () { date -u -d "$2 next Thu" $1; }
|
||||||
day_of_week=$(date +%u)
|
|
||||||
|
|
||||||
next_thursday_offset=$(( ( ( 7 - $day_of_week ) + 4 ) % 7 ))
|
|
||||||
|
|
||||||
## Check if next Thursday is the first of a month
|
## Check if next Thursday is the first of a month
|
||||||
|
|
||||||
if (( $(date -d "+$next_thursday_offset days" +%_d) > 7 )); then
|
if (( $(date_fmt +%_d) > 7 )); then
|
||||||
echo "Invitation should be sent at most a week in advance."
|
echo "Invitation should be sent at most a week in advance."
|
||||||
echo "Exiting without sending an inviation..."
|
echo "Exiting without sending an inviation..."
|
||||||
exit
|
exit
|
||||||
|
@ -23,10 +22,25 @@ fi
|
||||||
|
|
||||||
## Send invitation
|
## Send invitation
|
||||||
|
|
||||||
prose_date=$(date -d "+$next_thursday_offset days" +%d.%m.%Y)
|
prose_date=$(date_fmt +%d.%m.%Y)
|
||||||
url_date=$(date -d "+$next_thursday_offset days" +%Y%m%d)
|
url_date=$(date_fmt +%Y%m%d)
|
||||||
|
|
||||||
script_path=$(readlink -f "$0")
|
script_path=$(readlink -f "$0")
|
||||||
source_directory=$(dirname "$script_path")
|
source_directory=$(dirname "$script_path")
|
||||||
|
|
||||||
cat "$source_directory/$body_file" | sed -e "s/PROSEDATE/$prose_date/g" | sed -e "s/URLDATE/$url_date/g" | mail -s "$subject" -r "$from" "${to[@]}"
|
sed -e "s/#DTSTART#/$(date_fmt +%Y%m%dT%H%M%SZ "TZ=\"Europe/Berlin\" 20:00")/" \
|
||||||
|
-e "s/#DTEND#/$(date_fmt +%Y%m%dT%H%M%SZ "TZ=\"Europe/Berlin\" 21:00")/" \
|
||||||
|
-e "s/#DTSTAMP#/$(date -u +%Y%m%dT%H%M%SZ)/" \
|
||||||
|
-e "s/#SUMMARY#/KrautSpace Plenum/" \
|
||||||
|
-e "s/#LOCATION#/${location}/" \
|
||||||
|
-e "s/#FROM#/${from}/g" \
|
||||||
|
-e "s/#REPLY_TO#/${replyto}/g" \
|
||||||
|
-e "s/#URLDATE#/${url_date}/g" \
|
||||||
|
invite.ics > /tmp/invite.ics
|
||||||
|
|
||||||
|
sed -e "s/PROSEDATE/$prose_date/g" \
|
||||||
|
-e "s/URLDATE/$url_date/g" \
|
||||||
|
"$source_directory/$body_file" | mail -s "$subject" -r "$from" -a /tmp/invite.ics "${to[@]}"
|
||||||
|
ret=$?
|
||||||
|
rm -f /tmp/invite.ics
|
||||||
|
exit $ret
|
||||||
|
|
|
@ -4,3 +4,5 @@ Description=Send invitation to Hackspace's Plenum
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/opt/plenums_invite/invite.sh
|
ExecStart=/opt/plenums_invite/invite.sh
|
||||||
|
|
||||||
|
PrivateTmp=yes
|
||||||
|
|
Loading…
Reference in a new issue