beginning to work on the tools :)
authorChristian Weiske <cweiske@cweiske.de>
Thu, 27 Jan 2011 21:11:49 +0000 (22:11 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 27 Jan 2011 21:11:49 +0000 (22:11 +0100)
README [new file with mode: 0644]
lines-to-stdout.php [new file with mode: 0644]
multilinefile [new file with mode: 0644]
work-with-lines.sh [new file with mode: 0755]

diff --git a/README b/README
new file mode 100644 (file)
index 0000000..a2ad7a3
--- /dev/null
+++ b/README
@@ -0,0 +1,12 @@
+1. pipe each received line to a command
+2. command splits up line into variables
+3. add variable data to rrdtool
+4. repeat
+
+
+idea: cat socat output to "read"
+
+
+
+Test it:
+$ php lines-to-stdout.php | ./work-with-lines.sh
diff --git a/lines-to-stdout.php b/lines-to-stdout.php
new file mode 100644 (file)
index 0000000..eb6b39d
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+
+$n = 0;
+while ($n < 4) {
+    echo $n++ . ';col2;col3;col4' . "\n";
+    sleep(1);
+}
+
+?>
\ No newline at end of file
diff --git a/multilinefile b/multilinefile
new file mode 100644 (file)
index 0000000..00c077e
--- /dev/null
@@ -0,0 +1,6 @@
+line1
+line2
+line3
+a
+b
+c
diff --git a/work-with-lines.sh b/work-with-lines.sh
new file mode 100755 (executable)
index 0000000..9e52c9d
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+#split words by semicolons
+IFS=";"
+
+#Beispielausgabe USB-WDE1:
+# $1;1;;13,8;22,7;22,6;17,8;22,2;21,2;22,9;;59;35;38;49;38;40;35;;;;;;;0
+# Doku des Formats in 92030_USB_WDE1_V1.0_UM.pdf bei elv.de verfügbar
+
+#Variablenamen:
+# t1-t8: Temperatur in °C der Sensoren 1-8
+# f1-f8: Feuchtegrad in % der Sensoren 1-8
+# tc:    Temperatur Kombinsensor in °C
+# fc:    Feuchtegrad Kombinsensor in %
+# wg:    Windgeschwindigkeit in km/h
+# ns:    Niederschlag (Wippenschläge)
+# regen: Regen 1=ja, 0=nein
+while read -r startzeichen zustand zeitstempel\
+              t1 t2 t3 t4 t5 t6 t7 t8\
+              f1 f2 f3 f4 f5 f6 f7 f8\
+              tc fc wg ns regen
+do
+    echo "line:"
+    echo 1: $one , 2: $two, 3: $three, 4: $four
+done
+echo "done with everything"