-
-
Save nurrony/8c7bbc10f97b4233586770b58c198221 to your computer and use it in GitHub Desktop.
Shell init for docker container with signal handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Uncomment to print commands being executed | |
# set -x | |
pid=0 | |
# SIGTERM-handler | |
term_handler() { | |
echo "Handler INT"; | |
if [ $pid -ne 0 ]; then | |
kill -SIGTERM "$pid" | |
wait "$pid" | |
fi | |
exit 130; | |
} | |
# setup handlers | |
trap term_handler INT TERM | |
# Run app | |
java -jar server local.yml & | |
pid="$!" | |
while true | |
do | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment