blob: 1afd27ea711c5c1a6361953904cf43f87e8fc0f5 [file] [log] [blame]
Ray Milkey97dfd1e2016-06-20 17:04:19 -07001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Finds an app in the system.
4# -----------------------------------------------------------------------------
5
6[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7. $ONOS_ROOT/tools/build/envDefaults
8
Jon Hallfb6009d2017-02-15 16:01:17 -08009aux=/tmp/stc/stc-$$.log
Ray Milkey97dfd1e2016-06-20 17:04:19 -070010trap "rm -f $aux 2>/dev/null" EXIT
11
12echo onos-find-app: $*
13
14target=${1:-$OCI}
15app=$2
16id=$3
17set -x
18
19onos $target "onos:apps" | tee $aux
20appString=`cat $aux | grep "name=$app,"`
21
22if [ $? -ne 0 ]
23then
24 exit 1;
25fi
26
27state='inactive'
28if [ appString != "" ]
29then
30 if [[ ${appString:0:1} == '*' ]]
31 then
32 state='active'
33 fi
34 for token in '$appString'
35 do
36 if [[ $token =~ "id=" ]]
37 then
38 echo "@stc ${id}Id=${token}"
39 fi
40 done
41 echo "@stc ${id}State=${state}"
42 exit 0
43fi
44
45
46cat $aux
47exit 1
48