Skip to content

Instantly share code, notes, and snippets.

@djo
djo / run.sh
Last active January 27, 2020 04:35
Handling of UNIX-signals in Erlang/Elixir is not supported, this script provides start-stop management with handling TERM signal for Docker installation.
#!/usr/bin/env bash
set -x
term_handler() {
echo "Stopping the server process with PID $PID"
erl -noshell -name "[email protected]" -eval "rpc:call('[email protected]', init, stop, [])" -s init stop
echo "Stopped"
}
trap 'term_handler' TERM INT