Last active
August 9, 2017 11:01
-
-
Save simonswine/c0467ff768c0544ca878f421fe8198f6 to your computer and use it in GitHub Desktop.
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
| #!/bin/bash | |
| _term() { | |
| echo "Caught SIGTERM signal, wait for 30s before forwarding it to gunicorn" | |
| sleep 30 | |
| kill -TERM "$pid" 2>/dev/null | |
| } | |
| trap _term SIGTERM | |
| echo "starting gunicorn..."; | |
| gunicorn "$@" & | |
| pid=$! | |
| wait "$pid" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment