Files
KalBot/entrypoint.sh

20 lines
465 B
Bash

#!/bin/sh
echo "[Entrypoint] Starting Kalbot worker..."
node worker.js &
WORKER_PID=$!
echo "[Entrypoint] Starting Next.js server..."
node server.js &
SERVER_PID=$!
# Trap signals and forward to both processes
trap "kill $WORKER_PID $SERVER_PID 2>/dev/null; exit 0" SIGTERM SIGINT
# Wait for either to exit
wait -n
EXIT_CODE=$?
echo "[Entrypoint] A process exited with code $EXIT_CODE. Shutting down..."
kill $WORKER_PID $SERVER_PID 2>/dev/null
exit $EXIT_CODE