Last active
November 17, 2016 17:28
-
-
Save danielperezr88/7c30ec3d80dba88a56a8a08d024ff937 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
# call "rabbitmqctl stop" when exiting | |
trap "{ echo Stopping rabbitmq; rabbitmqctl stop; exit 0; }" TERM | |
echo Starting rabbitmq | |
rabbitmq-server & | |
# from docs: When Bash receives a signal for which a | |
# trap has been set while waiting for a command to | |
# complete, the trap will not be executed until the | |
# command completes. | |
# | |
# This is why we use & and wait here. Idea taken from: | |
# http://veithen.github.io/2014/11/16/sigterm-propagation.html | |
PID=$! | |
wait $PID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment