Running Webrick server in background? Running Webrick server in background? ruby ruby

Running Webrick server in background?


The Output is already giving you the answer:

=> Call with -d to detach


In general, you can use:

command &

And it will detach from the terminal window.

If you are using Linux, another options is to use screen:

screen# start your process# press Ctrl+a# press Ctrl+d

Voila! It's detached. Then you can call screen -r and your process will be back as if nothing happened.


If you run rails s --helpYou will see a bunch of options

Usage: rails server [mongrel, thin etc] [options]    -p, --port=port                  Runs Rails on the specified port.                                     Default: 3000    -b, --binding=IP                 Binds Rails to the specified IP.                                     Default: localhost    -c, --config=file                Uses a custom rackup configuration.    -d, --daemon                     Runs server as a Daemon.    -u, --debugger                   Enables the debugger.    -e, --environment=name           Specifies the environment to run this server under (test/development/production).                                     Default: development    -P, --pid=pid                    Specifies the PID file.                                     Default: tmp/pids/server.pid    -h, --help                       Shows this help message.

The one that you need is to run it as a Daemon. Hence, the solution is:rails s -d