mirror of
https://github.com/multipleof4/KalBot.git
synced 2026-03-16 21:41:02 +00:00
Feat: Entrypoint runs both Next.js and worker process
This commit is contained in:
19
entrypoint.sh
Normal file
19
entrypoint.sh
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/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
|
||||||
Reference in New Issue
Block a user