diff --git a/cht-petals/setup-petals.sh b/cht-petals/setup-petals.sh index f467df5..f62aabb 100755 --- a/cht-petals/setup-petals.sh +++ b/cht-petals/setup-petals.sh @@ -1,11 +1,12 @@ #!/usr/bin/env bash # Usage: setup-petals.sh [--model-path=] [--dht-prefix=] [--port=] +set -eEuo pipefail -tmpdir="${PREM_APPDIR:-.}/$(uuid)" +tmpdir="${PREM_APPDIR:-.}/petals-$(uuid)" cleanup(){ for i in $(jobs -p); do - kill -n 9 $i + kill -n 9 $i || : done rm -rf "$tmpdir" exit 0 @@ -13,6 +14,7 @@ cleanup(){ trap "cleanup" SIGTERM trap "cleanup" SIGINT +trap "cleanup" ERR # clone source git clone -n --depth=1 --filter=tree:0 https://github.com/premAI-io/prem-services.git "$tmpdir"