Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I shutdown a rails server without a console?

I started a "rails server" in my Mac OS X terminal. Supposedly if I just hit Ctrl+c in that terminal, I can shut it down. But I accidentally closed the terminal and now I can't shut it down.

I started another test project and try "rails server" again, and I got

Address already in use - bind(2) (Errno::EADDRINUSE)" error.

Can anyone help?

like image 579
T1000 Avatar asked Nov 26 '10 08:11

T1000


1 Answers

You can use killall -9 rails to kill all running apps with "rails" in the name.

The app should have died when the window closed though I have seen Ruby and/or Rails apps stick. You can have the system tell you if any "ruby" or "rails" apps are running with one of these commands:

ps auxw | grep ruby
ps auxw | grep rails`

This is the output of the first one:

greg     14461   0.3  0.7  2483432  15000 s001  S+   10:10PM   1:03.43 /Users/greg/.rvm/rubies/ruby-1.9.2-p0/bin/ruby script/rails c

You can see the path to the running app which will help identify the job. The number in the second column is the process ID. kill -9 14461 would kill it. Or, like above the killall command will do it by searching for apps with rails in the name.

like image 126
the Tin Man Avatar answered Nov 05 '22 22:11

the Tin Man