start mongrel server in terminal

3.9k views Asked by At

If I start mongrel the error will come. What can I do? Tell me another way to start Mongrel please...

$script/server mongrel

=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.2.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
Exiting
/usr/lib/ruby/1.8/mongrel/tcphack.rb:12:in `initialize_without_backlog': Address already in use - bind(2) (Errno::EADDRINUSE)
    from /usr/lib/ruby/1.8/mongrel/tcphack.rb:12:in `initialize'
    from /usr/lib/ruby/1.8/mongrel.rb:93:in `new'
    from /usr/lib/ruby/1.8/mongrel.rb:93:in `initialize'
    from /usr/lib/ruby/1.8/mongrel/configurator.rb:139:in `new'
    from /usr/lib/ruby/1.8/mongrel/configurator.rb:139:in `listener'
    from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:in `cloaker_'
    from /usr/lib/ruby/1.8/mongrel/configurator.rb:50:in `call'
    from /usr/lib/ruby/1.8/mongrel/configurator.rb:50:in `initialize'
     ... 19 levels...
    from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from script/server:3
thanks 
kingston
2

There are 2 answers

0
Simone Carletti On

The error means you have an other server already running on the port 3000. Either quit that server or start Mongrel on another port.

$ script/server mongrel -p 3001
0
rubyprince On

I had this experience that when I start mongrel server and use Ctrl-C to shut down the mongrel server in ubuntu, the server will not shut down, and I wont be able to start the mongrel server in the same port until some time(or perhaps till a system restart). So, do not exit terminal while running a mongrel server. When you have to shut down the mongrel server, use Ctrl-Alt-C in ubuntu.