dogecoin-qt was being killed abruptly on container stop. Send SIGHUP directly to the child process for a graceful shutdown instead of SIGTERM'ing the whole process group. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EzpyzTGGvRC1FdaJkEHYyP
36 lines
605 B
Bash
Executable File
36 lines
605 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Signal helper
|
|
source /app/signals.sh
|
|
|
|
echo Using DISPLAY $DISPLAY
|
|
export XDG_RUNTIME_DIR=/tmp/runtime-doge
|
|
|
|
set -x
|
|
|
|
PID=$$
|
|
TERM_handler() {
|
|
SIGNAME="$1"
|
|
echo "Killing ${PID}"
|
|
echo "Signal ${SIGNAME}"
|
|
if [ ${PID} -ne 0 ]; then
|
|
ps -ef --forest
|
|
CHILDS=$(pgrep -P "${PID}")
|
|
kill -SIGHUP $CHILDS
|
|
for i in $CHILDS; do
|
|
wait $i
|
|
done
|
|
fi
|
|
ps -ef --forest
|
|
ret=$(signal_return_val ${SIGNAME})
|
|
exit $ret
|
|
}
|
|
|
|
signals_trap_with_arg TERM_handler SIGTERM SIGINT
|
|
|
|
# Application
|
|
dogecoin-qt&
|
|
|
|
# wait forever
|
|
signals_wait_forever
|