diff --git a/barcodeinterpret b/barcodeinterpret index 7063e9f2..3a008ce3 100755 --- a/barcodeinterpret +++ b/barcodeinterpret @@ -1,6 +1,19 @@ #!/bin/bash # interpret Interleaved 2/5 barcode 58 byte barcode values used by the ProBell tape management system +scriptdir=`dirname "$0"` +. "$scriptdir/mmvariables" +. "$scriptdir/mmfunctions" +[ ! -f "$scriptdir/mmvariables" -o ! -f "$scriptdir/mmfunctions" ] && { echo "Missing '$scriptdir/mmvariables' and/or '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; + +cleanup(){ + log -a "Process aborted" + exit 1 +} + +trap cleanup SIGHUP SIGINT SIGTERM +log -b + if test $# != 1 then echo "You must supply one argument, a scanned interleaved 2/5 barcode value"; exit @@ -55,3 +68,4 @@ if [[ $(echo "$materialid" | tail -c +9 | head -c 1) == "H" ]] ; then materialid="${materialid}D" fi echo deviceid,$(echo $ids | cut -d ' ' -f 1),materialid,$materialid,som,`addcolons $(echo $barcode | cut -c 42-49)`,duration,`addcolons $(echo $barcode | cut -c 50-57)` +log -e \ No newline at end of file