Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env bash
set -x
pid=0
sigterm_handler() {
echo "sigterm handler called..."
if [ $pid -ne 0 ]; then
kill -TERM "$pid"
echo "scala application terminated..."
wait "$pid"
fi
exit 143;
}
trap 'kill ${!}; sigterm_handler' TERM
#running scala application
sbt run &
pid="$!"
echo "PID=$pid"
# wait forever
while true
do
tail -f /dev/null & wait ${!}
done
set +x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment