From 8816475b592a57bb1e1703c79cbf2a26e8728461 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 9 Feb 2011 19:03:58 +0100 Subject: [PATCH] integrate dummy data generator, check for readability of usb device, use full path to logging script --- munin/usb-wde1-log-last.sh | 20 ++++++++++++++++---- 1 file 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 # # 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 -- 2.30.2