-
-
Save tghastings/54668646fbb6e12ee8f34f9cafe9dbde to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
# SIGTERM-handler | |
term_handler() { | |
${TOMCAT_DIR}/bin/shutdown.sh | |
exit 143; # 128 + 15 -- SIGTERM | |
} | |
# setup handlers | |
# on callback, kill the last background process, which is `tail -f /dev/null` and execute the specified handler | |
trap 'kill ${!}; term_handler' SIGTERM | |
# run application | |
${TOMCAT_DIR}/bin/startup.sh | |
ln -sf /dev/stdout ${TOMCAT_DIR}/catalina.out | |
# wait forever | |
while true | |
do | |
tail -f /dev/null & wait ${!} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment