Running Webrick server in background?

MBPro:shovell myname$ ruby script/server => Booting WEBrick => Rails 2.3.8 application starting on => Call with -d to detach => Ctrl-C to shutdown server [2010-08-01 15:28:35] INFO WEBrick 1.3.1 [2010-08-01 15:28:35] INFO ruby 1.9.1 (2010-07-02) [i386-darwin10.4.0] [2010-08-01 15:28:35] INFO WEBrick::HTTPServer#start: pid=36349 port=3000

After this command, I have to keep the terminal open, can't even get out using Cmd+z. Can't I run it as a background service?


-------------Problems Reply------------

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:

# 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.

The mongrel gem can do this easy.

gem install mongrel

Then you should be able to use

mongrel_rails start -d

-d for daemon mode.

Category:ruby on rails Views:13 Time:2010-08-01

Related post

Copyright (C), All Rights Reserved.

processed in 0.126 (s). 11 q(s)