Acacia Acacia - 2 months ago 5
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.


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