From 5287a9a10507c998540ac51442ff451a280dc05c Mon Sep 17 00:00:00 2001 From: Kamal Wickramanayake Date: Sun, 5 Jul 2026 21:26:54 +0530 Subject: Microservices: Added start-all.sh file --- microservices/start-all.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 microservices/start-all.sh diff --git a/microservices/start-all.sh b/microservices/start-all.sh new file mode 100755 index 0000000..d00c79a --- /dev/null +++ b/microservices/start-all.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +echo Starting the authorization server, API gateway, resourece server, Vite dev server... + +# 1. Clean up background tasks on CTRL+C (SIGINT) or script exit +cleanup() { + echo " Catching CTRL+C. Terminating background jobs..." + # Kill all child processes of this script + pkill -P $$ + exit 1 +} + +# 2. Assign the cleanup function to the INT signal +trap cleanup INT + +# 3. Start your background commands using '&' +echo "Starting tasks..." + +cd 01-oauth2-server +./mvnw spring-boot:run & +# Wait a few seconds until authorization server starts +sleep 10 + +cd ../02-api-gateway +./mvnw spring-boot:run & + +cd ../03-resource-server +./mvnw spring-boot:run & + +sleep 10 +cd ../04-react-app +npm run dev + +# 4. Wait for all background processes to finish +wait -- cgit v1.2.3