<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Jeff Dyke wrote:
<blockquote
cite="mid:8496caf30807020539l5e1eca75t77bbe4a64c247ef8@mail.gmail.com"
type="cite">
<blockquote type="cite">
<pre wrap="">I just parse the twistd.pid file and os.kill(pid, signal.SIGTERM). This
does a 'nice' shutdown, each service that the twistd daemon is running will
call it's stopService method for cleanup and shut down in an orderly manner.
</pre>
</blockquote>
<pre wrap=""><!---->makes sense.
</pre>
<blockquote type="cite">
<pre wrap="">PS. the signal above is in a shutdown command in the app that does any
necessary app level clean-up first, although I guess you could put that
clean-up in your service's stopService method too.
</pre>
</blockquote>
<pre wrap=""><!---->
what do you mean is in a shutdown command in the app, how do you tell
the app to execute the shutdown command containing os.kill? If i can
figure all this out and more, i'd love to fulfill that feature
request.
thanks
</pre>
</blockquote>
def handle_shutdown(self, user, *args):<br>
if user.account.access is not AllAccess.Owner:<br>
self.hideCommand(user)<br>
else:<br>
pid = int(file('twistd.pid', mode = 'r').readline())<br>
os.kill(pid, signal.SIGUSR1)<br>
user.socket.sendToClient('Normal shutdown, rotating
logfiles.\r\n')<br>
os.kill(pid, signal.SIGTERM)<br>
<br>
Here's my handle_shutdown method, slightly abbreviated.<br>
Just call this the same way you give the app any other input....IE: if
it is a web app, put an admin control clickie somewhere that activates
it. If it is a custom client, put a control in that, if it is a direct
TCP app (telnet) make the command parser call it when the user enters
the proper command.<br>
<br>
<br>
</body>
</html>