summaryrefslogtreecommitdiffstats
path: root/scripts/weekrun
blob: 859deed62b6473d9ce78660f8e69c194e028db42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# requires: wget git
set -euf
NOW=$(date -I)
OUTDIR=${OUTDIR:-$PWD}
DATADIR=${DATADIR:-$OUTDIR/db}
PDFDIR=${PDFDIR:-$OUTDIR/pdf}

# old: thyssenkruppsystemengineering
# empty: metabo-nuertingen

mkdir -p $DATADIR $PDFDIR
for i in thales-deutschland ibm-boeblingen buerocampus-wangen continental-villingen;do
  db=$DATADIR/$i.json
  arafetch --db $db --cantine $i
  ara2influx $db --cantine $i
  db=$PDFDIR/$i-$NOW.pdf
  wget http://gast.aramark.de/$i/menu/pdf/woche_de.php -O $db || echo "Unable to fetch pdf plan of $i"

done

# commit changes
pushd $DATADIR
if ! test -e .git;then
  echo "initializing git repo for $DATADIR"
  git init
  git config user.email "arafetch@localhost"
  git config user.name "arafetch daemon"
fi
git add -A
git commit -m "update $NOW"
popd