Files
fsr_generator/read_db.sh

16 lines
737 B
Bash
Executable File

#!/bin/bash -e
read -s -p "DB-Passwort: " password;
echo
raw_proto=$(echo $password | ssh fsmi "psql -A -t -h fsmi-db fsmi -c \"select datum from protokolle where ist_veroeffentlicht='f' and name is null order by datum asc\"" 2> /dev/null)
echo $password | ssh fsmi "psql -A -t -h fsmi-db fsmi -c \"select protokoll from protokolle where ist_veroeffentlicht='f' and name is null order by datum desc limit 1\"" 2> /dev/null > data/last_proto
for proto in $raw_proto;
do
echo "* FSR-Protokoll vom $proto"
echo "$proto" > data/last_date
done > data/uvproto.txt
grep -oP '(?<=nächste Redeleitung: ).*(?=</li>)' data/last_proto > data/redeleitung
grep -oP '(?<=nächstes Protokoll: ).*(?=</li>)' data/last_proto > data/protokoll