aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-02-09 19:03:58 +0100
committerChristian Weiske <cweiske@cweiske.de>2011-02-09 19:03:58 +0100
commit8816475b592a57bb1e1703c79cbf2a26e8728461 (patch)
tree2d613727f0d4cc11a31b70a5af33efba0f25d44c
parent372a95ade862f2d7bd661c464a4a2a9852070dfb (diff)
downloadusb-wde1-tools-8816475b592a57bb1e1703c79cbf2a26e8728461.tar.gz
usb-wde1-tools-8816475b592a57bb1e1703c79cbf2a26e8728461.zip
integrate dummy data generator, check for readability of usb device, use full path to logging script
-rwxr-xr-xmunin/usb-wde1-log-last.sh20
1 files changed, 16 insertions, 4 deletions
diff --git a/munin/usb-wde1-log-last.sh b/munin/usb-wde1-log-last.sh
index 0752498..db27a13 100755
--- a/munin/usb-wde1-log-last.sh
+++ b/munin/usb-wde1-log-last.sh
@@ -4,11 +4,23 @@
# run this script as follows:
# $ nohup ./usb-wde1-log-last.sh &
#
+# Use --dummy-data as parameter to log dummy data only
+#
# License: http://www.gnu.org/licenses/agpl.html AGPL
# Author: Christian Weiske <cweiske@cweiske.de>
#
# FIXME: send RESET or INIT and M2
-# FIXME: use absolute path for log-single-line.sh
-#
-socat /dev/ttyUSB0,b9600 STDOUT\
- | ./log-single-line.sh /tmp/usb-wde1-last
+
+curdir="$(dirname "$0")"
+if [ "$1" = "--dummy-data" ]; then
+ $curdir/../dummy-data-generator.php\
+ | $curdir/log-single-line.sh /tmp/usb-wde1-last
+else
+ if [ ! -r /dev/ttyUSB0 ]; then
+ echo "Device /dev/ttyUSB0 is not readable"
+ exit 1
+ fi
+
+ socat /dev/ttyUSB0,b9600 STDOUT\
+ | $curdir/log-single-line.sh /tmp/usb-wde1-last
+fi