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
27
27
mkdir -p /data
28
28
cd /data
29
29
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 $?
31
39
fi
32
40
fi
33
41
Original file line number Diff line number Diff line change @@ -94,7 +94,15 @@ if ! test -e ${CARDANO_DATABASE_PATH}/protocolMagicId; then
94
94
if [[ $( cd ${CARDANO_DATABASE_PATH} ; pwd -P) != $( pwd -P) /db ]]; then
95
95
rm -rf db/*
96
96
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 $?
98
106
if [[ $( cd ${CARDANO_DATABASE_PATH} ; pwd -P) != $( pwd -P) /db ]]; then
99
107
mv -f db/* ${CARDANO_DATABASE_PATH} /
100
108
fi
You can’t perform that action at this time.
0 commit comments