views:

60

answers:

2

I have a command line server for which I want to create a wrapper in python. The idea is that the wrapper receives commands like:

my_wrapper start
my_wrapper stop
my_wrapper restart
my_wrapper status

And handles the server in background, unlinked to the terminal that launched it from the wrapper.

I was about to start thinking on how to do it and thought on the golden rule, DRY.

Do you know of any example code I should start reading before starting my first line?

Update:

I noticed I didn't include that the server is a jar file, so I'll have to run it using subprocess or something similar.

I'd prefer not to use modules that are not included in python's standard lib.

A: 

Check this out: http://scripts.top4download.com/advpy/download-nwkku.html

fixxxer
I couldnd't find any useful code there....
Santi
+1  A: 

You could use an implementation of PEP 3143 - Standard daemon process library. One existing is python-daemon.

I'd prefer not to use external libs. Also, the server I'm running is not python code, it looks like I can still use subprocess with python-daemon, but I'd prefer to keep it more simple.
Santi