Communicating with a running python daemon

前端 未结 8 1641
一个人的身影
一个人的身影 2020-12-07 07:45

I wrote a small Python application that runs as a daemon. It utilizes threading and queues.

I\'m looking for general approaches to altering this application so that

8条回答
  •  独厮守ぢ
    2020-12-07 08:26

    I would use twisted with a named pipe or just open up a socket. Take a look at the echo server and client examples. You would need to modify the echo server to check for some string passed by the client and then respond with whatever requested info.

    Because of Python's threading issues you are going to have trouble responding to information requests while simultaneously continuing to do whatever the daemon is meant to do anyways. Asynchronous techniques or forking another processes are your only real option.

提交回复
热议问题