Modify container signal handling
All checks were successful
Docker Build and Push / build-and-push (push) Successful in 1m12s
All checks were successful
Docker Build and Push / build-and-push (push) Successful in 1m12s
This commit is contained in:
@@ -4,10 +4,13 @@
|
|||||||
python generate_config.py && python pterodisbot.py &
|
python generate_config.py && python pterodisbot.py &
|
||||||
|
|
||||||
# Capture the application's process ID
|
# Capture the application's process ID
|
||||||
pid=$!
|
PID=$!
|
||||||
|
|
||||||
# Trap the SIGTERM signal and pass it through to the process upon container receiving stop command
|
# Trap SIGTERM (from Docker) and convert it to SIGINT (for Python)
|
||||||
trap "kill -TERM $pid" SIGTERM
|
trap "echo 'Received SIGTERM, converting to SIGINT'; kill -SIGINT $PID" SIGTERM
|
||||||
|
|
||||||
# Wait for process to complete
|
# Also trap SIGINT (for manual Ctrl+C) and forward it
|
||||||
wait $pid
|
trap "kill -SIGINT $PID" SIGINT
|
||||||
|
|
||||||
|
# Wait for the process to exit
|
||||||
|
wait $PID
|
Reference in New Issue
Block a user