views:

114

answers:

1

Problem:

I have a python script that I have running as a service. It's a subclass of the win32 class win32serviceutil.ServiceFramework. I want a simple straightforward way of sending arbitrary commands to it via the command line.

What I've looked at:

It looks like the standard way of controlling the service once it's started is by using another program and sending it command signals, but I need to be able to send a short string to it as well as an argument. It looks like using a NamedPipe might be a good idea, but it's really too complex for what I wanted to do, is there any other simpler way?

+2  A: 

Not really.

You have many, many ways to do "Interprocess Communication" (IPC) in Python.

A common solution is to use HTTP and define "RESTful" commands. Your service listens on port 80 for HTTP requests that contain arguments and parameters. Look at wsgiref for more information on this.

S.Lott
THanks. This is sort of what my research came up with. I think that I'm going to end up going with NamedPipes.
Robbie
We use WSGI because -- overall -- it's very, very simple to implement with the wsgiref library. Our clients use urllib2 to make requests.
S.Lott