I am new to rails and I am using an ubuntu machine and the rubymine IDE. The problem is that I am unable to stop the rails server. I tried to stop the server by killing the
When the rails server does not start it means that it is already running then you can start by using new port eg.
rails s -p 3001
or it starts and stops in that case you want to delete temp folder in rails directory structure it starts the rails server.
Just open the file using the location given
sudo vi /Users/user1/go/src/github.com/rails_app/rails_project/tmp/pids/server.pid
find the process_id / thread_id at which the process is runnning.
Kill the specified process / thread using kill -9 84699
I have noticed on Windows (Im using 10 but not sure if the same for oler). If you use cmd.exe and ctrl + c the raisl server stops correctly.
However, if you use Git Bash, it doesn't. It says it has but when you look at the tmp pids, its still there.
Maybe a bug with git bash?
You can use other ports like the following:
rails server -p 3001
Normally in your terminal you can try Ctrl + C
to shutdown the server.
The other way to kill the Ruby on Rails default server (which is WEBrick
) is:
kill -INT $(cat tmp/pids/server.pid)
In your terminal to find out the PID of the process:
$ lsof -wni tcp:3000
Then, use the number in the PID column to kill the process:
For example:
$ kill -9 PID
And some of the other answers i found is:
To stop the rails server while it's running, press:
CTRL-C
CTRL-Z
You will get control back to bash
. Then type (without the $
):
$ fg
And this will go back into the process, and then quit out of Rails s
properly.
It's a little annoying, but this sure beats killing the process manually. It's not too bad and it's the best I could figure out.
You can use killall -9 rails
to kill all running apps with "rails
" in the name.
killall -9 rails
Press Ctrl - C it will stop
if not check
Ctrl-Z should normally do the trick.