Thomas Vachuska

Fixed onos-log so ctrl-c will only kill the current monitor an added onos-log-ki…

…ll command to kill all monitors.

Change-Id: Id76b13f801aae0d9878baa265601717ef20613c8
...@@ -23,12 +23,11 @@ instance=$2 ...@@ -23,12 +23,11 @@ instance=$2
23 if [ $less -eq 1 ]; then 23 if [ $less -eq 1 ]; then
24 ssh -t $remote "less $LOG" 24 ssh -t $remote "less $LOG"
25 else 25 else
26 - trap "ssh $remote 'ps -ef | grep \"tail -n 512\" | grep -v grep | cut -c10-15 | xargs kill'" EXIT
27 ssh -t $remote " 26 ssh -t $remote "
28 while true; do 27 while true; do
29 echo ================================================================== 28 echo ==================================================================
30 [ ! -f $LOG ] && sleep 2 && continue 29 [ ! -f $LOG ] && sleep 2 && continue
31 - tail -n 512 --follow=name $LOG --sleep-interval 2 30 + tail -n 512 --follow=name $LOG --pid \$$ --sleep-interval 2
32 done 31 done
33 " 32 "
34 fi 33 fi
......
1 +#!/bin/bash
2 +# -----------------------------------------------------------------------------
3 +# Kills all remote ONOS log file monitors on the specified node.
4 +# -----------------------------------------------------------------------------
5 +
6 +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7 +. $ONOS_ROOT/tools/build/envDefaults
8 +. $ONOS_ROOT/tools/test/bin/find-node.sh
9 +
10 +less=0
11 +[ "$1" = "-l" ] && shift && less=1
12 +
13 +remote=$(find_node $1)
14 +remote=$ONOS_USER@${remote:-$OCI}
15 +
16 +ssh $remote "ps -ef | grep \"tail -n 512\" | grep -v grep | cut -c10-15 | xargs kill"