cleanClusterEnv.sh 625 字节
Newer Older
P
Ping Xiao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#!/bin/bash
echo "Executing cleanClusterEnv.sh"
CURR_DIR=`pwd`

if [ $# != 2 ]; then 
  echo "argument list need input : "  
  echo "  -d docker dir" 
  exit 1
fi

DOCKER_DIR=
while getopts "d:" arg
do
  case $arg in
    d)
      DOCKER_DIR=$OPTARG
      ;;    
    ?)
      echo "unkonwn argument"
      ;;
  esac
done

function removeDockerContainers {
    cd $DOCKER_DIR
    docker-compose down --remove-orphans
}

function cleanEnv {
  echo "Clean up docker environment"    
31
  for i in {1..10}
P
Ping Xiao 已提交
32 33 34 35 36 37 38 39
  do    
    rm -rf $DOCKER_DIR/node$i/data/*    
    rm -rf $DOCKER_DIR/node$i/log/*
  done
}

removeDockerContainers
cleanEnv