Thomas Vachuska | 13a93f3 | 2016-11-22 14:15:04 -0800 | [diff] [blame] | 1 | #!/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 | |
| 10 | node=$(find_node ${1:-$OCI}) |
| 11 | |
| 12 | remote=$ONOS_USER@$node |
| 13 | |
| 14 | ssh -t $remote " |
| 15 | # Wait until ONOS Java process terminates |
Thomas Vachuska | 822bc14 | 2016-11-22 15:47:23 -0800 | [diff] [blame] | 16 | for i in {1..90}; do |
Thomas Vachuska | 13a93f3 | 2016-11-22 14:15:04 -0800 | [diff] [blame] | 17 | 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 Vachuska | db9b7f4 | 2016-11-29 16:40:09 -0800 | [diff] [blame^] | 22 | |
| 23 | [ $? -eq 0 ] && exit 0 |
| 24 | [ "$2" = "--kill" ] && onos-kill $node && exit 0 |
| 25 | |
| 26 | exit 1 |