views:

72

answers:

1

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?

+2  A: 

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.

rlotun