Added -l option to onos-log to use less on the log instead of tail
Change-Id: Ib6aaa5c12b85483eb3e2ec021b6daceb40994b6c
diff --git a/tools/test/bin/onos-log b/tools/test/bin/onos-log
index c9748a0..a336462 100755
--- a/tools/test/bin/onos-log
+++ b/tools/test/bin/onos-log
@@ -6,6 +6,10 @@
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
+less=0
+
+[ "$1" = "-l" ] && shift && less=1
+
remote=$ONOS_USER@${1:-$OCI}
instance=$2
@@ -15,10 +19,14 @@
trap "ssh $remote 'ps -ef | grep \"tail -n 512\" | grep -v grep | cut -c10-15 | xargs kill'" EXIT
-ssh $remote "
+if [ $less -eq 1 ]; then
+ ssh -t $remote "less $LOG"
+else
+ ssh $remote "
while true; do
echo ==================================================================
[ ! -f $LOG ] && sleep 2 && continue
tail -n 512 --follow=name $LOG --sleep-interval 2
done
-"
+ "
+fi