From bada1f5013789909c2339b6d1c71caaf3414fe82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Schweizer?= Date: Fri, 30 Mar 2018 23:44:28 +0200 Subject: no easter meetup --- inc/de/meetup.shtml | 3 ++- index.shtml | 2 +- index.shtml~ | 17 ++++++++++++++ meetup/gen_dates_tech.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 index.shtml~ create mode 100755 meetup/gen_dates_tech.sh diff --git a/inc/de/meetup.shtml b/inc/de/meetup.shtml index 882fdda..b84b2bc 100644 --- a/inc/de/meetup.shtml +++ b/inc/de/meetup.shtml @@ -1,7 +1,8 @@

Nächstes Treffen

- Montag, ab 20 Uhr
+ ab 20 Uhr
+ --> im realraum, Brockmanngasse 15

diff --git a/index.shtml b/index.shtml index 846eb5e..6d4ef02 100644 --- a/index.shtml +++ b/index.shtml @@ -7,7 +7,7 @@

Nächstes Tech/Core-Treffen:
- Montag, 26.3.2018 20 Uhr + Montag, 23.4.2018 20 Uhr

diff --git a/index.shtml~ b/index.shtml~ new file mode 100644 index 0000000..8c8d595 --- /dev/null +++ b/index.shtml~ @@ -0,0 +1,17 @@ + + + +
+ +

Funkfeuer Graz

+ +

+ Nächstes Tech/Core-Treffen:
+ Montag, 26.2.2018 20 Uhr +

+ + + + +
+ diff --git a/meetup/gen_dates_tech.sh b/meetup/gen_dates_tech.sh new file mode 100755 index 0000000..0bc4479 --- /dev/null +++ b/meetup/gen_dates_tech.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# generates the upcoming meetups for Funkfeuer Graz Homepage +# +# this script should be called by cron every day (night) +# how far in the future should i go? +LIMIT=3 + +# uncomment to enable debug +#DEBUG=1 + +# where to put the output files? +NEXT_FILE="next.html" +AFTER_FILE="after.html" + +DOW=`date +"%u"` +if [ $DOW -eq 1 ]; then + DOM=`date +"%e"` + TS=`date +"%s"` +else + DOM=`date --date="next monday" +"%e"` + TS=`date --date="next monday" +"%s"` +fi + +MEETUPS="" +CNT=0 +while true; do + if [ -n "$DEBUG" ]; then echo -n "check day($TS): "`date --date="@$TS" +"%d.%m.%Y"`; fi + + if [ $DOM -le 7 ] || ([ $DOM -ge 15 ] && [ $DOM -le 21 ]); then + if [ -n "$DEBUG" ]; then echo " -> ok"; fi + MEETUPS="$MEETUPS $TS" + CNT=$((CNT + 1)) + if [ $CNT -ge $LIMIT ]; then + break; + fi + else + if [ -n "$DEBUG" ]; then echo ""; fi + fi + TS=$((TS + (7 * 24 * 3600))) + DOM=`date --date="@$TS" +"%e"` +done + +set -- $MEETUPS +NEXT=$1 +shift +FUTURE=$@ + +date --date="@$NEXT" +"%d.%m.%Y" > "$NEXT_FILE.new" +echo "" >> "$AFTER_FILE.new" +mv "$NEXT_FILE.new" "$NEXT_FILE" +mv "$AFTER_FILE.new" "$AFTER_FILE" + +exit 0 -- cgit v1.2.1