I have a number of scripts written in Python 2.6 that can be run arbitrarily. I would like to have a single central script that collects the output and displays it in a single log.
Ideally it would satisfy these requirements:
I've come across some hints:
os.pipe()
multiprocess
mutex
logging.handlers.SocketHandler
(thanks @Dan Head)From those pieces, I think I could cobble something together. Just wondering if there is an obviously 'right' way of doing this, or if I could learn from anyone's mistakes.
I'd consider using logging.handlers.SocketHandler
for the message passing parts of this, it sounds like you have a logging type use case in mind already.
The standard libraries logging facilities are very flexible and configuration driven so you should be able to adapt them to your requirements.
This doesn't handle the automatic restarting part of your question. For UNIX you'd probably just use pid files and os.kill(pid, 0)
to check if it's running, but I don't know what their equivalents in the Windows world would be.