File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,15 @@ if ! test -e /data/db/protocolMagicId; then
2727 mkdir -p /data
2828 cd /data
2929 echo " Starting: /usr/local/bin/mithril-client snapshot download ${SNAPSHOT_DIGEST} "
30- mithril-client snapshot download ${SNAPSHOT_DIGEST}
30+ # Handle SIGTERM during initial sync
31+ trap ' kill -TERM $(pidof mithril-client)' TERM
32+ # Run mithril-client in the background so we can capture the PID and wait
33+ mithril-client snapshot download ${SNAPSHOT_DIGEST} &
34+ _mithril_pid=$!
35+ wait $_mithril_pid || exit $?
36+ # Reset signal handler and wait again (to avoid race condition)
37+ trap - TERM
38+ wait $_mithril_pid || exit $?
3139 fi
3240fi
3341
Original file line number Diff line number Diff line change @@ -94,7 +94,15 @@ if ! test -e ${CARDANO_DATABASE_PATH}/protocolMagicId; then
9494 if [[ $( cd ${CARDANO_DATABASE_PATH} ; pwd -P) != $( pwd -P) /db ]]; then
9595 rm -rf db/*
9696 fi
97- mithril-client snapshot download ${SNAPSHOT_DIGEST}
97+ # Handle SIGTERM during initial sync
98+ trap ' kill -TERM $(pidof mithril-client)' TERM
99+ # Run mithril-client in the background so we can capture the PID and wait
100+ mithril-client snapshot download ${SNAPSHOT_DIGEST} &
101+ _mithril_pid=$!
102+ wait $_mithril_pid || exit $?
103+ # Reset signal handler and wait again (to avoid race condition)
104+ trap - TERM
105+ wait $_mithril_pid || exit $?
98106 if [[ $( cd ${CARDANO_DATABASE_PATH} ; pwd -P) != $( pwd -P) /db ]]; then
99107 mv -f db/* ${CARDANO_DATABASE_PATH} /
100108 fi
You can’t perform that action at this time.
0 commit comments