좋아, 그래서 레일에서 자체를 다시 시작하는 작업을 만들고 싶습니다. 좀 검색을했고, 발견레일스에서 레일스를 다시 시작하는 방법은 무엇입니까?
이 명령을 제안http://snippets.dzone.com/posts/show/5002
, 하나는 중지하고 다른 다시 시작. 다음 명 :
ps -a|grep "/usr/local/bin/ruby script/server"|grep -v "grep /usr"|cut -d " " -f1|xargs -n 1 kill -KILL $1
-HUP 신호가 나를 위해 다시 시작하지 않는, 그래서 위의 명령을 난도질하려는 (조정 때문에 명령이 어떻게 우분투에서 서버를 시작하고 함께 잘 작동) :
ps -eaf|grep "ruby script/server"|grep -v grep|cut -d " " -f3|xargs -n 1 kill -KILL $1;script/server
이 내 환경에서 잘 작동, 그래서 그것을 실행하는 작업을 설정하려고 :
이def restart
fork { exec "ps -eaf|grep \"ruby script/server\"|grep -v grep|cut -d \" \" -f3|xargs -n 1 kill -KILL $1;script/server" }
redirect_to "/server_maintenance"
end
조치는 서버의 벌금을 죽이고, 실제로는 U에게 서버를 다시 시작하지 않습니다 p :
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/tcphack.rb:12:in `initialize_without_backlog': Address already in use - bind(2) (Errno::EADDRINUSE)
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/tcphack.rb:12:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:93:in `new'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:93:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb:10:in `new'
from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb:10:in `run'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:111
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
Mongrel이 방금 종료 된 것처럼 보이는 이유는 주소가 이미 사용중인 이유입니다.
나는이 질문에 발견How do you restart Rails under Mongrel, without stopping and starting Mongrel
을하지만 신호는, 내 환경에서 다시 시작을 유발하지 않는 그들은 단지 과정을 죽이고 결국.
누구나 사용할 수있는 아이디어가 있습니까? 내 환경에 대한 몇 가지주의 사항 : 새로운 버전의 RubyGems 및 Mongrel에서 Rails를 설치했습니다. 스크립트/서버를 사용하여 서버를 시작합니다. 물론 Mongrel을 사용합니다. 나는 우분투 하디 헤론에있다.
응답 해 주셔서 감사합니다. 나는 당신이 반응하기 전에 실제로 약간의 작업을하고 있지만 링크가 어떻게 작동하는지 보여 주므로 upvote! –