Created
November 12, 2010 21:00
-
-
Save idan/674678 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
def gunicorn_pid(): | |
"""Gets the PID of a supervisord-managed gunicorn""" | |
result = sudo('supervisorctl status %s' % env.proj_name) | |
m = re.search(r'pid (?P<pid>\d+)', result) | |
if m: | |
return m.group('pid') or None | |
def gunicorn_hup(): | |
"""Sends HUP to gunicorn in order to gracefully restart the servers""" | |
pid = gunicorn_pid() | |
if pid: | |
sudo('kill -HUP %s' % pid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment