github.com/cyverse/go-irodsclient@v0.13.2/test/server/start.sh (about)

     1  #! /bin/bash
     2  cfg=config.inc
     3  
     4  set -o errexit -o nounset -o pipefail
     5  
     6  if [[ "$OSTYPE" == "darwin"* ]]
     7  then
     8    readonly ExecName=$(greadlink -f "$0")
     9  else
    10    readonly ExecName=$(readlink --canonicalize "$0")
    11  fi
    12  
    13  main()
    14  {
    15    local baseDir=$(dirname "$ExecName")
    16  
    17    if [ -z "$cfg" ]
    18    then
    19      printf 'An environment variable include file is needed.\n' >&2
    20      return 1
    21    fi
    22  
    23    . "$baseDir/$cfg"
    24  
    25    if ! command -v docker-compose > /dev/null; then
    26      docker compose --file "$baseDir"/docker-compose.yml --project-name "$ENV_NAME" down --remove-orphans
    27      docker compose --file "$baseDir"/docker-compose.yml --project-name "$ENV_NAME" up -d
    28  
    29      timeout 60s grep -q 'ready' <(docker compose -p irods_test logs -f irods)
    30    else
    31      docker-compose --file "$baseDir"/docker-compose.yml --project-name "$ENV_NAME" down --remove-orphans
    32      docker-compose --file "$baseDir"/docker-compose.yml --project-name "$ENV_NAME" up -d
    33  
    34      timeout 60s grep -q 'ready' <(docker-compose -p irods_test logs -f irods)
    35    fi
    36  }
    37  
    38  
    39  main "$@"