Skip to content

Instantly share code, notes, and snippets.

@simonswine
Last active August 9, 2017 11:01
Show Gist options
  • Select an option

  • Save simonswine/c0467ff768c0544ca878f421fe8198f6 to your computer and use it in GitHub Desktop.

Select an option

Save simonswine/c0467ff768c0544ca878f421fe8198f6 to your computer and use it in GitHub Desktop.
#!/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