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
Follow these steps:
1. Simply Delete the pid file from rails app directory
Rails_app -> tmp -> pids -> pid file
Delete the file and run
rails start
2. For Rails 5.0 and above, you can use this command
rails restart
pkill -9 rails
to kill all the process of rails
Updated answer
ps aux|grep 'rails'|grep -v 'grep'|awk '{ print $2 }'|xargs kill -9
This will kill any running rails process. Replace 'rails' with something else to kill any other processes.
On rails 6 using
ps aux | grep rails
was not returning the server process
I had to do
ps aux | grep puma
to find the actual process and then kill it using
kill -9 {process_id}
Following are steps to kill server process:
1. lsof -i tcp:3000
2. kill -9 1234
where 1234
is the PID of process: localhost:3000 display in step 1.
OR
Remove file(server.pid) under Rails.root/tmp/pids/
and restart server.
OR
open app in another port by using command:
rails s -p 3001
One super easy way would be
gem install shutup
then go in the current folder of your rails project and run
shutup
# this will kill the Rails process currently running
You can use the command 'shutup' every time you want
DICLAIMER: I am the creator of this gem
NOTE: if you are using rvm install the gem globally
rvm @global do gem install shutup