aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-05-12 07:52:13 -0700
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-05-12 07:52:13 -0700
commit19a4c45deb53685c176ae6dcd27d5ff0b6c129ca (patch)
tree56e004a531800e62c05abcc01accb420c3bb9e93
parent950cbadbcc2376acc44af5595c8f60b68fc26c5c (diff)
Get and kill ROP_file_creator.sh childs as well
Change-Id: I07393a0f62535563586278d2e8bc8fd6bd9380db Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
-rwxr-xr-xtest/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
index 3de96dafe..b1aa43749 100755
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
@@ -141,8 +141,20 @@ function running_containers(){
}
function stop(){
- get_pnfsim_ip
- kill $(ps -ef | grep "[.]/ROP_file_creator.sh $1" | head -n 1 | awk '{print $2}')
+ get_pnfsim_ip
+
+ set +e # override global script setting
+ declare -a pids_to_kill
+ # get ROP_file_creator.sh instance pid
+ pids_to_kill[0]=$(pgrep -f "ROP_file_creator.sh ${1}$")
+ if [[ ! -z ${pids_to_kill[0]} ]];
+ then
+ # get ROP_file_creator.sh childs pids
+ pids_to_kill=(${pids_to_kill[@]} $(pgrep -P ${pids_to_kill[0]}))
+ kill ${pids_to_kill[@]}
+ else
+ echo "ROP_file_creator.sh already not running"
+ fi
if [[ $(running_containers) ]]; then
docker-compose -f $RUNNING_COMPOSE_CONFIG down
@@ -262,4 +274,4 @@ function timestamp(){
date "+%Y-%m-%d_%T"
}
-main $@ \ No newline at end of file
+main $@