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.
You could use an implementation of PEP 3143 – Standard daemon process library. One existing is python-daemon.