开发者

Right way to create [self]respawning app in python

I am using jabber bot written in python to log some MUC talks. Sometimes it drops on some network or XMPP problems. In this case I have to start it again by myself. The goal is to make it "self-respawning".

I have some variants about how to 开发者_如何学运维do it.

  1. Bot is one process. Another process monitors its activity and starts it if bot died.
  2. Main process spawns bot subprocess and controls it.

Also I think daemonizing bot process is useful here. Platform is Linux, as you could guess.

What is the right way to solve this problem?


If you're using something like ubuntu, try looking into upstart and its automatic daemonization and "respawn" feature. Here's a good general blogpost about running vs. starting processes.

I've also heard good things about supervisdord.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜