Skip to content
Snippets Groups Projects
Commit ace29123 authored by Gilles Filippini's avatar Gilles Filippini
Browse files

docker: move sigterm handling up to the entrypoint

Having it into the duniter.sh script prevents using duniter subcommands
such as `duniter wizard key` which are then launched in the background.

Moving it into the entrypoint makes the subcommands available again.
parent e87912d8
Branches pini-docker
No related tags found
1 merge request!1437docker: move sigterm handling up to the entrypoint
Pipeline #32547 passed
......@@ -121,7 +121,18 @@ else
set -- $MAX_OLD_SPACE_SIZE "$@"
fi
# Terminate gracefully on SIGTERM by propagating it to the 'node' process
sigterm () {
echo "Received SIGTERM. Terminating..." >&2
pkill node
wait %1
}
trap 'sigterm' TERM
# Start duniter
# Launch in background and wait
# This way we can catch SIGTERM
echo Starting duniter with:
echo /usr/bin/duniter "$@"
exec /usr/bin/duniter "$@"
/usr/bin/duniter "$@" &
wait %1
#!/bin/sh
# Terminate gracefully on SIGTERM by propagating it to the 'node' process
sigterm () {
echo "Received SIGTERM. Terminating..." >&2
pkill node
wait %1
}
trap 'sigterm' TERM
# Main
cd /duniter
if [ "$1" != --home ]; then
set -- --home /var/lib/duniter "$@"
fi
# Launch in background and wait
# This way we can catch SIGTERM
bin/duniter "$@" &
wait %1
exec bin/duniter "$@"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment