From 012c3d361fc2f6855f3612967aada0fa04aac188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Dur=C3=A1n=20Casta=C3=B1eda?= Date: Fri, 4 May 2012 20:18:37 +0200 Subject: [PATCH] One 'ctrl-c' kills keystone. Fixes bug 928564. Change-Id: I5ba157244d5ba9a018244141c27806db2b82f1e8 --- bin/keystone-all | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bin/keystone-all b/bin/keystone-all index f58c2a03a6..075b007edd 100755 --- a/bin/keystone-all +++ b/bin/keystone-all @@ -4,6 +4,7 @@ import greenlet import logging import os +import signal import sys # If ../keystone/__init__.py exists, add ../ to Python search path, so that @@ -30,7 +31,15 @@ def create_server(conf, name, host, port): return wsgi.Server(app, host=host, port=port) +def sigint_handler(signal, frame): + """Exits at SIGINT signal.""" + logging.debug('SIGINT received, stopping servers.') + sys.exit(0) + + def serve(*servers): + signal.signal(signal.SIGINT, sigint_handler) + for server in servers: logging.debug("starting server %s on port %s", server.application,