From 4313edc993e6dd995ba2ea4a26dffe9d4a29a607 Mon Sep 17 00:00:00 2001 From: Nils Jakobi Date: Mon, 4 Nov 2019 22:27:41 +0100 Subject: [PATCH] first draft of enhanced version --- Dockerfile | 8 ++++++-- crontab | 17 +---------------- nodePoller.sh | 9 +++++++++ 3 files changed, 16 insertions(+), 18 deletions(-) create mode 100755 nodePoller.sh diff --git a/Dockerfile b/Dockerfile index 7c2623a..30a90ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,13 @@ -FROM alpine:3.7 -LABEL maintainer "Stefan Hoffmann>" +FROM alpine:3.10.3 +LABEL maintainer "Stefan Hoffmann, Nils Jakobi" # Configure cron COPY crontab /etc/cron/crontab +# Copy script +WORKDIR /opt/fftdf/ +COPY nodePoller.sh . + # Init cron RUN crontab /etc/cron/crontab diff --git a/crontab b/crontab index 7ebe49e..af71e72 100644 --- a/crontab +++ b/crontab @@ -1,16 +1 @@ -* * * * * wget http://4.fftdf.de/graph.json -O /opt/data/tdf4/graph.json -* * * * * 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 +* * * * * /opt/fftdf/nodePoller.sh \ No newline at end of file diff --git a/nodePoller.sh b/nodePoller.sh new file mode 100755 index 0000000..bb4ee00 --- /dev/null +++ b/nodePoller.sh @@ -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 \ No newline at end of file