AtlatestRepositoryapiary
1
#!/usr/bin/env bash2
#3
# Tear down the throwaway enclave-server started by env-up.sh.4
#5
# Kills ONLY the PID recorded in state.env. Never a pattern match:6
# another harness may be running the same binary on this host, and an7
# agent session's own command line typically contains the task name it8
# would match on. See README.md.9
set -u10
RUN=${HARNESS_RUN:-/tmp/apiary-harness}11
[ -f "$RUN/state.env" ] || { echo "no $RUN/state.env -- nothing to stop"; exit 0; }12
. "$RUN/state.env"13
if kill -0 "$SERVER_PID" 2>/dev/null; then14
kill "$SERVER_PID" && echo "killed enclave server pid=$SERVER_PID"15
else16
echo "server pid=$SERVER_PID already gone"17
fi