>> Now I only have to find a reliable way of detecting if sb_server is >> already running, start it if needed, and shut it down when done. > > There are various ways to check this, e.g.: > > 1. If you're sure that nothing else on the machine will try and use > the same ports as SpamBayes, then you can check to see whether a > connection is accepted (either to a proxy port or to the HTML UI port). > > 2. You can grep through ps and check for a 'python > sb_server.py' (or however you have it setup) process. > > 3. You could add code to the open_platform_mutex function in > sb_server to open some sort of lock for your platform (e.g. create a > directory, and delete it on close) and use that to check whether > sb_server is running.
Thank you for the suggestions Tony. I think I'll use ps -A | grep sb_server.py 99.9% of the time sb_server won't be running anyway, because I am not using sb_server but sb_filter. The only thing now is how to shut down sb_server.py without any output. pkilling it doesn't seem to be the way to do it, but I'll leave that as an excercise to myself. -- Amedee Van Gasse _______________________________________________ [email protected] http://mail.python.org/mailman/listinfo/spambayes Check the FAQ before asking: http://spambayes.sf.net/faq.html
