blob: 3e0c945f90d3103554e90a5fac0b1fcec9de4bed [file] [log] [blame]
tom5a18e802014-09-18 12:38:15 -07001#!/bin/bash
2#-------------------------------------------------------------------------------
tom1a2908c2014-09-23 16:37:39 -07003# Monitors remote ONOS log file on the specified node.
tom5a18e802014-09-18 12:38:15 -07004#-------------------------------------------------------------------------------
5
6[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7. $ONOS_ROOT/tools/build/envDefaults
8
9remote=$ONOS_USER@${1:-$OCI}
10
11LOG=$ONOS_INSTALL_DIR/log/karaf.log
12
tom1f3805d2014-09-18 19:58:47 -070013trap "ssh $remote 'ps -ef | grep \"tail -n 512\" | grep -v grep | cut -c10-15 | xargs kill'" EXIT
14
tom5a18e802014-09-18 12:38:15 -070015ssh $remote "
16 while true; do
tomcaf3bf72014-09-23 13:20:53 -070017 echo ==================================================================
tom5a18e802014-09-18 12:38:15 -070018 [ ! -f $LOG ] && sleep 2 && continue
19 tail -n 512 --follow=name $LOG --sleep-interval 2
20 done
21"