[rhmessaging-commits] rhmessaging commits: r3068 - mgmt/trunk/cumin/python/cumin.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Thu Jan 22 15:13:06 EST 2009
Author: nunofsantos
Date: 2009-01-22 15:13:06 -0500 (Thu, 22 Jan 2009)
New Revision: 3068
Modified:
mgmt/trunk/cumin/python/cumin/tools.py
Log:
BZ475999 - mint not shutdown by iniscript; add SIGTERM signal handler
Modified: mgmt/trunk/cumin/python/cumin/tools.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/tools.py 2009-01-22 20:06:04 UTC (rev 3067)
+++ mgmt/trunk/cumin/python/cumin/tools.py 2009-01-22 20:13:06 UTC (rev 3068)
@@ -428,6 +428,8 @@
def __init__(self, name):
super(CuminServerTool, self).__init__(name)
+ signal.signal(signal.SIGTERM, self.sigTermHandler)
+
self.description = "Cumin web server"
param = ConfigParameter(self.config, "addr", str)
@@ -450,6 +452,9 @@
opt = CommandOption(self, "ssl")
opt.description = "Serve web pages using SSL"
+ def sigTermHandler(self, signum, frame):
+ sys.exit(1)
+
class MintProcess(object):
def __init__(self):
self.proc = None
@@ -468,19 +473,21 @@
self.proc = Popen(args)
def stop(self):
- os.kill(self.proc.pid, signal.SIGTERM)
+ if self.proc.poll is not None:
+ os.kill(self.proc.pid, signal.SIGTERM)
for i in range(30):
code = self.proc.poll()
if code is not None:
+ log.debug("Mint subprocess %i terminated", self.proc.pid)
return
sleep(1)
os.kill(self.proc.pid, signal.SIGKILL)
- log.warn("Mint subprocess %i wouldn't go gracefully",
+ log.warn("Mint subprocess %i wouldn't go gracefully, killed",
self.proc.pid)
def do_run(self, opts, args):
More information about the rhmessaging-commits
mailing list