github.com/cloudfoundry-attic/garden-linux@v0.333.2-candidate/linux_backend/bin/destroy.sh (about)

     1  #!/bin/bash
     2  
     3  [ -n "$DEBUG" ] && set -o xtrace
     4  set -o nounset
     5  set -o errexit
     6  shopt -s nullglob
     7  
     8  if [ $# -ne 1  ]
     9  then
    10    echo "Usage: $0 <instance_path>"
    11    exit 1
    12  fi
    13  
    14  target=$1
    15  
    16  # Ignore tmp directory
    17  if [ $(basename $target) == "tmp" ]
    18  then
    19    exit 0
    20  fi
    21  
    22  if [ -d $target ]
    23  then
    24    if [ -f $target/destroy.sh ]
    25    then
    26      $target/destroy.sh
    27    fi
    28  
    29    rm -rf $target
    30  fi