Files
herolib/libarchive/baobab/generator/templates/run.sh.template
2025-08-29 09:48:13 +02:00

42 lines
1.2 KiB
Bash
Executable File

#!/bin/bash -ex
DIR="@{dollar}(cd "@{dollar}(dirname "@{dollar}{BASH_SOURCE[0]}")" && pwd)"
echo "@{dollar}DIR"
chmod +x @{dollar}{DIR}/run_actor.vsh
@{dollar}{DIR}/run_actor.vsh &
ACTOR_PID=@{dollar}!
chmod +x @{dollar}{DIR}/run_actor_example.vsh
@{dollar}{DIR}/run_actor_example.vsh &
EXAMPLE_ACTOR_PID=@{dollar}!
chmod +x @{dollar}{DIR}/run_http_server.vsh
@{dollar}{DIR}/run_http_server.vsh &
HTTP_SERVER_PID=@{dollar}!
# Print desired output
echo "${actor_title} Actor Redis Interface running on redis://localhost:6379"
echo "* /queues/${actor_name} -> Action Interface"
echo ""
echo "${actor_title} Actor HTTP Server running on http://localhost:8080"
echo "* http://localhost:8080/playground/openapi -> OpenAPI Playground"
echo "* http://localhost:8080/openapi -> OpenAPI Interface"
# echo "* http://localhost:8080/docs -> Documentation"
echo ""
# Function to clean up when script is killed
cleanup() {
echo "Stopping background processes..."
kill "@{dollar}ACTOR_PID" "@{dollar}HTTP_SERVER_PID" 2>/dev/null
wait
echo "All processes stopped."
exit 0
}
# Trap SIGINT (Ctrl+C), SIGTERM, and SIGQUIT to call cleanup
trap cleanup SIGINT SIGTERM SIGQUIT
# Wait for processes to finish
wait