[medusa] Re: How do I stop medusa gracefully

skip@c... skip@c...
Wed, 21 Apr 1999 23:57:11 -0000


I'm just starting to use Medusa via the ZServer stuff with Zope. I'd like to be able to identify and kill my servers by process id. Accordingly, my ZServer/start.py looks like

open(PID_FILE, "w").write("%d\n" % os.getpid())

... yada yada yada ...

asyncore.loop()

try: os.unlink(PID_FILE)
except os.error: pass

The only problem is when I kill the process, asyncore.loop appears not to return in the usual fashion (calls sys.exit somewhere I suppose). I wind up with a lot of pid files laying about (for various reasons they currently have the pid in the file name).

Is there some way I can get asyncore.loop to return in the usual manner?

Thanks,

Skip Montanaro


------------------------------------------------------------------------
eGroup home: http://www.eGroups.com/group/medusa
Free Web-based e-mail groups by eGroups.com