X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fo1-interface.git;a=blobdiff_plain;f=ntsimulator%2Fscripts%2Fclean.sh;h=2d9bd569f811a1178939ca12bda944dba910c0f6;hp=7e9735b92d87370014b1d24589a638ceff3de745;hb=34ec819462d5f81ceeb723e47467bf50a8454f34;hpb=a86f6e2391dcd2e7793f7218f3b91e3a7e0e3bf5 diff --git a/ntsimulator/scripts/clean.sh b/ntsimulator/scripts/clean.sh index 7e9735b..2d9bd56 100755 --- a/ntsimulator/scripts/clean.sh +++ b/ntsimulator/scripts/clean.sh @@ -1,7 +1,7 @@ -#/bin/bash +#!/bin/bash ################################################################################ # -# Copyright 2019 highstreet technologies GmbH and others +# Copyright 2020 highstreet technologies GmbH and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,10 +15,17 @@ # See the License for the specific language governing permissions and # limitations under the License. ################################################################################ +if [ "$#" -ne 1 ]; then + echo "ID Parameter missing." + echo "Usage: $0 id + +where id is the docker container id of the NTS Manager instance that we want to clean. " + exit 1 +fi -echo "Cleaning up..." +echo "Cleaning up containers started by the NTS Manager $1..." -mapfile -t NTS_containers < <( docker ps -a --filter "label=NTS" --format "{{.ID}}" ) +mapfile -t NTS_containers < <( docker ps -a --filter "label=NTS_Manager=$1" --format "{{.ID}}" ) CONTAINERS="" @@ -29,13 +36,13 @@ then do CONTAINERS="$CONTAINERS $container" done - echo "Cleaning up ontainers: $CONTAINERS" + echo "Cleaning up containers: $CONTAINERS" docker kill $CONTAINERS > /dev/null 2>&1 docker rm $CONTAINERS > /dev/null 2>&1 fi -echo "Cleaning NTS Manager container" -docker kill NTS_Manager > /dev/null 2>&1 -docker rm NTS_Manager > /dev/null 2>&1 +echo "Cleaning NTS Manager $1..." +docker kill $1 > /dev/null 2>&1 +docker rm $1 > /dev/null 2>&1 echo "All cleaned up!"