Skip to content

Instantly share code, notes, and snippets.

@NeelamLakra
Last active February 25, 2019 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NeelamLakra/5f19a1bfc61179b77add7c72dcd8d257 to your computer and use it in GitHub Desktop.
Save NeelamLakra/5f19a1bfc61179b77add7c72dcd8d257 to your computer and use it in GitHub Desktop.
#!/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