http://www.perlmonks.org?node_id=185233


in reply to [untitled node, ID 185227]

You can launch the bot and watch the process or the connection (I am not sure if you mean the whole process dies, or just becomes disconnected). In your loop look to see if the process is still active, if he is not turn him back on.
something like
launch bot while (1) if [ bot not connected, alive or whatever] restart, reconnect or whatever... end while
Depending on the exact implementation and platform this may be rolled up for you in a module.
good luck