blob: a4974224f601fcafb56931625e3dd6c60f4beb98 [file] [log] [blame]
Thomas Vachuska13a93f32016-11-22 14:15:04 -08001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Waits for ONOS java process to terminate.
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
10node=$(find_node ${1:-$OCI})
11
12remote=$ONOS_USER@$node
13
14ssh -t $remote "
15 # Wait until ONOS Java process terminates
Thomas Vachuska822bc142016-11-22 15:47:23 -080016 for i in {1..90}; do
Thomas Vachuska13a93f32016-11-22 14:15:04 -080017 ps -ef | egrep 'java .*/onos/.* org\.apache\.karaf\.main\.Main' | grep -qv grep || exit 0
18 sleep 1
19 done
20 exit 1
21"
Thomas Vachuskadb9b7f42016-11-29 16:40:09 -080022
23[ $? -eq 0 ] && exit 0
24[ "$2" = "--kill" ] && onos-kill $node && exit 0
25
26exit 1