How to stop (and restart) the Rails Server?

匿名 (未验证) 提交于 2019-12-03 02:45:02

问题:

I'm following the instructions here http://railsinstaller.org/mac to get up and running with Rails on a Mac running OS X 10.8.2

At step 8 I'm asked to restart Rails server but how?

I'm assuming via a command line, but from within the already open ruby terminal window or a new one?

回答1:

Press Ctrl+C

When you start the server it mentions this in the startup text.



回答2:

On OSX, you can take advantage of the UNIX-like command line - here's what I keep handy in my .bashrc to enable me to more easily restart a server that's running in background (-d) mode (note that you have to be in the Rails root directory when running this):

alias restart_rails='kill -9 `cat tmp/pids/server.pid`; rails server -d' 


回答3:

Now in rails 5 yu can do:

rails restart 

This print by rails --tasks

Restart app by touching tmp/restart.txt

I think that is usefully if you run rails as a demon



回答4:

In case that doesn't work there is another way that works especially well in Windows: Kill localhost:3000 process from Windows command line



回答5:

I had to restart the rails application on the production so I looked for an another answer. I have found it below:

http://wiki.ocssolutions.com/Restarting_a_Rails_Application_Using_Passenger



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!