Modify container signal handling
All checks were successful
Docker Build and Push / build-and-push (push) Successful in 1m8s
All checks were successful
Docker Build and Push / build-and-push (push) Successful in 1m8s
This commit is contained in:
@@ -1,16 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Run the application in the background
|
||||
python generate_config.py && python pterodisbot.py &
|
||||
if ! python generate_config.py; then
|
||||
echo "Failed to generate config"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Capture the application's process ID
|
||||
PID=$!
|
||||
|
||||
# Trap SIGTERM (from Docker) and convert it to SIGINT (for Python)
|
||||
trap "echo 'Received SIGTERM, converting to SIGINT'; kill -SIGINT $PID" SIGTERM
|
||||
|
||||
# Also trap SIGINT (for manual Ctrl+C) and forward it
|
||||
trap "kill -SIGINT $PID" SIGINT
|
||||
|
||||
# Wait for the process to exit
|
||||
wait $PID
|
||||
exec python pterodisbot.py
|
Reference in New Issue
Block a user