每當我使用運行在服務器服務器初始化錯誤...必須使用「的ps aux | grep的軌道」每次
rails s
我得到這個消息:
=> 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>'
然後,我要使用
ps aux | grep rails
和
kill -9 <pid>
rails s
我的問題是:
有沒有辦法讓我沒有做到這一點,我可以輕鬆地運行使用
rails s
每次
服務器..
即使..命令
rails s -p 4000
作品..
我只是好奇,如果有任何方法我可以每次使用相同的端口...所以我不必每次啓動服務器時都使用不同的端口,因爲這使得我必須重新輸入特定的控制器和動作名稱一次又一次...
你可以'killall -9 rails',但這裏的主要問題是,顯然rails已經在運行,你不知道它 - 是否在系統啓動時啓動?如果是這樣,你爲什麼要重新啓動它?在這種情況下,'/etc/init.d/rails restart'是一個選項(init.d中腳本的確切名稱可能不同,請檢查init.d) – fvu 2012-08-12 14:37:54
如何關閉服務器,任何出口時出現錯誤信息? – PriteshJ 2012-08-12 14:47:28
@fvu當我運行'killall -9 rails'它給出了這個輸出'rails:沒有找到流程' – 2012-08-12 17:20:53