Whenever I run the server using
rails s
I get this message:
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-08-12 19:57:32] INFO WEBrick 1.3.1
[2012-08-12 19:57:32] INFO ruby 1.9.3 (2012-04-20) [i686-linux]
[2012-08-12 19:57:32] WARN TCPServer Error: Address already in use - bind(2)
Exiting
/home/abhishek/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/utils.rb:85:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
from /home/abhishek/.rvm/rubies/ruby-1.9.3- p194/lib/ruby/1.9.1/webrick/utils.rb:85:in `new'
from /home/abhishek/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/utils.rb:85:in `block in create_listeners'
from /home/abhishek/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/utils.rb:82:in `each'
from /home/abhishek/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/utils.rb:82:in `create_listeners'
from /home/abhishek/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:82:in `listen'
from /home/abhishek/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:70:in `initialize'
from /home/abhishek/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:45:in `initialize'
from /home/abhishek/.rvm/gems/ruby-1.9.3-p194/gems/rack- 1.3.6/lib/rack/handler/webrick.rb:10:in `new'
from /home/abhishek/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.3.6/lib/rack/handler/webrick.rb:10:in `run'
from /home/abhishek/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.3.6/lib/rack/server.rb:265:in `start'
from /home/abhishek/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.0/lib/rails/commands/server.rb:70:in `start'
from /home/abhishek/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.0/lib/rails/commands.rb:54:in `block in <top (required)>'
from /home/abhishek/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.0/lib/rails/commands.rb:49:in `tap'
from /home/abhishek/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.0/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
And then I have to use
ps aux | grep rails
and
kill -9 <pid>
rails s
My question is:
Is there a way so that I dont have to do this and i can easily run the server using
rails s
every time..
even though.. the command
rails s -p 4000
works..
I am just curious if there is any way i can use the same port every time... so that I do not have to start with a different port every time I start the server as this makes me have to re-enter the specific controller and action name again and again...