Acacia Acacia -4 years ago 161
Ruby Question

Ruby TCP server closes

I have a TCP server I start with the following command;

nohup ruby ./server.rb &

However, after a couple of days, this process is just closed and cannot trace the point when it breaks,

How do i keep the TCP server alive for ever until stopped.

Answer Source

You should wrap your process in a daemon handler so it gets restarted automatically.

You make a launcher script called something like launcher.rb that looks like this:

require 'daemons''myserver.rb')

Then, as per the documentation:

ruby launcher.rb start
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download