#!/usr/bin/env bash # Starts the app on a clean port 8080 with the given profiles. # Usage: ./scripts/run.sh [profiles] e.g. ./scripts/run.sh rs256,resourceserver set -eu PROFILES="${1:-hs256}" for p in $(ps -eo pid,cmd | grep '[J]wtAuthDemoApplication' | awk '{print $1}'); do kill -9 "$p" || true; done sleep 2 setsid nohup mvn -B -o org.springframework.boot:spring-boot-maven-plugin:run \ -Dspring-boot.run.profiles="$PROFILES" > "/tmp/app-${PROFILES//,/-}.log" 2>&1 < /dev/null & for i in $(seq 1 60); do if curl -s -o /dev/null http://localhost:8080/api/public/ping 2>/dev/null; then echo "started with profiles: $PROFILES"; exit 0 fi sleep 2 done echo "failed to start; see /tmp/app-${PROFILES//,/-}.log" >&2; exit 1