first draft of enhanced version

This commit is contained in:
Nils Stinnesbeck 2019-11-04 22:27:41 +01:00
parent 5358d1e705
commit 4313edc993
Signed by: nils
GPG Key ID: 86D4882C6C6CA48B
3 changed files with 16 additions and 18 deletions

View File

@ -1,9 +1,13 @@
FROM alpine:3.7 FROM alpine:3.10.3
LABEL maintainer "Stefan Hoffmann>" LABEL maintainer "Stefan Hoffmann, Nils Jakobi"
# Configure cron # Configure cron
COPY crontab /etc/cron/crontab COPY crontab /etc/cron/crontab
# Copy script
WORKDIR /opt/fftdf/
COPY nodePoller.sh .
# Init cron # Init cron
RUN crontab /etc/cron/crontab RUN crontab /etc/cron/crontab

17
crontab
View File

@ -1,16 +1 @@
* * * * * wget http://4.fftdf.de/graph.json -O /opt/data/tdf4/graph.json * * * * * /opt/fftdf/nodePoller.sh
* * * * * wget http://4.fftdf.de/meshviewer.json -O /opt/data/tdf4/meshviewer.json
* * * * * wget http://4.fftdf.de/nodelist.json -O /opt/data/tdf4/nodelist.json
* * * * * wget http://4.fftdf.de/nodes.json -O /opt/data/tdf4/nodes.json
* * * * * wget http://5.fftdf.de/graph.json -O /opt/data/tdf5/graph.json
* * * * * wget http://5.fftdf.de/meshviewer.json -O /opt/data/tdf5/meshviewer.json
* * * * * wget http://5.fftdf.de/nodelist.json -O /opt/data/tdf5/nodelist.json
* * * * * wget http://5.fftdf.de/nodes.json -O /opt/data/tdf5/nodes.json
* * * * * wget http://6.fftdf.de/graph.json -O /opt/data/tdf6/graph.json
* * * * * wget http://6.fftdf.de/meshviewer.json -O /opt/data/tdf6/meshviewer.json
* * * * * wget http://6.fftdf.de/nodelist.json -O /opt/data/tdf6/nodelist.json
* * * * * wget http://6.fftdf.de/nodes.json -O /opt/data/tdf6/nodes.json
* * * * * wget http://7.fftdf.de:8080/graph.json -O /opt/data/tdf7/graph.json
* * * * * wget http://7.fftdf.de:8080/meshviewer.json -O /opt/data/tdf7/meshviewer.json
* * * * * wget http://7.fftdf.de:8080/nodelist.json -O /opt/data/tdf7/nodelist.json
* * * * * wget http://7.fftdf.de:8080/nodes.json -O /opt/data/tdf7/nodes.json

9
nodePoller.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
for i in 4 5 6 7
do
for f in meshviewer #graph nodelist nodes
do
curl http://$i.fftdf.de/$f.json -o /opt/data/tdf$i/$f.json || sed -i -e 's/"is_online":true/"is_online":false/g' /opt/data/tdf$i/$f.json
done
done