#!/bin/bash if [ "$1" == 'debug' ]; then set -x; shift; fi if [ "$1" == 'debug2' ]; then set -xvT; shift; fi #################################################### # - Trace - # Switch to module path and view the trace file #################################################### #------------------------ REALPATH=`realpath $0` WHERE=`dirname $REALPATH` ME=`basename $REALPATH` cd $WHERE . ../system.conf . ../watcher.conf . ../common.conf . ../common.bashlib #------------------------ if [ -z "$1" ] then echo "Specify which module to measure (LG,MX,MB,WB,Geo) ..." exit fi #MODNAME=`awk '{print toupper($0)}' <<< $1` MODNAME=${1^^} case $MODNAME in LG|MX|MB|WB) MOD_PATH=Watch$MODNAME ;; GE*) MOD_PATH=GeoTrack ;; esac . ../modules/$MOD_PATH/$MOD_PATH.conf > /dev/null 2>&1 if [ $? -ne 0 ] then echo "Ooops. No module $1" echo "Try one of LG, MB, MX, WB, Geo" exit fi if [ -z "$TRACE" ] then echo "Tracing for $1 is off" exit fi cd ../modules/$MOD_PATH exec tail -100f $MOD_PATH.trace