X-Git-Url: https://git.cweiske.de/usb-wde1-tools.git/blobdiff_plain/189154e200d964b0f2c810632a1ea70186be48af..76589ea07926b0101cae599736d13e4c507c8f97:/munin/usb-wde1-log-last.sh diff --git a/munin/usb-wde1-log-last.sh b/munin/usb-wde1-log-last.sh old mode 100644 new mode 100755 index 9fca864..620dd0c --- a/munin/usb-wde1-log-last.sh +++ b/munin/usb-wde1-log-last.sh @@ -1,5 +1,35 @@ #!/bin/sh # logs the last line. usable via nohup on the server +# +# 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 -socat /dev/ttyUSB0,b9600 STDOUT\ - | ./log-single-line.sh /tmp/usb-wde1-last + +device=/dev/ttyUSB0 + +if [ ! -d /var/spool/usb-wde1 ]; then + mkdir /var/spool/usb-wde1 +fi + +curdir="$(dirname "$0")" +if [ "$1" = "--dummy-data" ]; then + $curdir/../dummy-data-generator.php\ + | $curdir/log-single-line.sh /var/spool/usb-wde1/usb-wde1-last +else + if [ ! -r $device ]; then + echo "Device $device is not readable" + exit 1 + fi + + #socat breaks something that leads to + # WRONG VAL, WRONG CMD and FullBuff->Reset + # errors + socat $device,b9600,min=1,time=1,brkint=0,icrnl=0,ixoff=1,imaxbel=0,opost=0,isig=0,icanon=0,iexten=0,echo=0,echoe=0,echok=0 STDOUT\ + | $curdir/log-single-line.sh /var/spool/usb-wde1/usb-wde1-last +fi