24 lines
996 B
Bash
Executable File
24 lines
996 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Start the application with the given profiles: ./scripts/run.sh docsfilter
|
|
#
|
|
# Uses a plain `java -cp` launch rather than `mvn spring-boot:run` so that only one JVM starts
|
|
# per application. The Maven plugin forks a second JVM, which matters when you are running
|
|
# several of these at once on a small machine.
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
PROFILES="${1:-}"
|
|
[ -f target/cp.txt ] || mvn -B -q dependency:build-classpath -Dmdep.outputFile=target/cp.txt -Dmdep.includeScope=runtime
|
|
[ -d target/classes ] || mvn -B -q compile
|
|
./scripts/stop.sh
|
|
ARGS=""
|
|
[ -n "$PROFILES" ] && ARGS="--spring.profiles.active=$PROFILES"
|
|
setsid nohup java -Xmx256m -cp "target/classes:$(cat target/cp.txt)" \
|
|
com.ankurm.ssrf.SsrfDemoApplication $ARGS > /tmp/ssrf-app.log 2>&1 < /dev/null &
|
|
for _ in $(seq 1 60); do
|
|
curl -fs -o /dev/null http://127.0.0.1:8080/diag/filter && exit 0
|
|
sleep 1
|
|
done
|
|
echo "application did not start; see /tmp/ssrf-app.log" >&2
|
|
tail -30 /tmp/ssrf-app.log >&2
|
|
exit 1
|