Skip to content
Snippets Groups Projects
Commit 5311dd56 authored by pini's avatar pini
Browse files

Merge branch 'pini-docker-sigterm' into 'dev'

fix: gracefully exit on sigterm

See merge request !1410
parents 6b33b8ab 677b8163
No related branches found
No related tags found
1 merge request!1410fix: gracefully exit on sigterm
Pipeline #19136 passed
#!/bin/sh
set -uo pipefail
function boolean () {
boolean () {
echo "$1" | sed -E 's/^(true|yes|1)$/true/i'
}
big_fat_warning='\033[01;31m**WARNING**:\033[0m'
......
#!/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
exec bin/duniter "$@"
# Launch in background and wait
# This way we can catch SIGTERM
bin/duniter "$@" &
wait %1
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