#!/usr/bin/env bash # Delete the teams named as args, one at a time, via the panel API. # Each per-team delete runs `docker compose down` for every challenge, which # takes minutes for a 16-challenge team — so never do this in a foreground # call that has to finish inside one tool timeout. # Usage: delete_teams.sh [idx...] set -uo pipefail BASE=http://127.0.0.1:18081 JAR=/tmp/ejc U=$(grep -oP '^PANEL_ADMIN_USER=\K.*' /opt/gemastik18-final/panel/.env) P=$(grep -oP '^PANEL_ADMIN_PASS=\K.*' /opt/gemastik18-final/panel/.env) curl -sS -c "$JAR" -X POST -H 'Content-Type: application/json' \ -d "{\"user\":\"$U\",\"pass\":\"$P\"}" "${BASE}/api/login" >/dev/null for i in "$@"; do echo "=== $(date -Is) delete team${i} ===" curl -sS -b "$JAR" -X DELETE -H 'Content-Type: application/json' \ -d '{"purge_scores":true}' "${BASE}/api/teams/${i}" -w '\nHTTP %{http_code}\n' done echo "=== done ==="