When I try to start a server via rails s
, I get the following error message:
C:\Users\Frankie\Documents\stocktracker>rails s
=> Booting WEBrick
=> Rails 3.2.8 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
A server is already running. Check C:/Users/Frankie/Documents/stocktracker/tmp/p
ids/server.pid.
Exiting
The number listed in server.pid
is 8436.
How do I manually kill this process? How can I easily kill all webrick servers currently running?
Commanding it to die One way to shut down a rogue server is with the kill command. For the PID output above, you could kill the corresponding stuck server using kill 42612 . And if that didn't work, you could try kill -9 42612 .
So in doing research, I discovered I can kill any server with the following commands and instructions: lsof -i :<PORT NUMBER> (i.e. lsof -i :3000 ) Obtain the unique PID (process identifier) from lsof -i output. kill -QUIT <PID> (i.e. kill -QUIT 4091 )
If the process view is not already threaded by parent-child relation, then press Ctrl-T a few times until it is. You then should be able to see the webserver. Select it, and then right-click on it. Select "Kill Process Tree" to forcibly kill the webserver.
You can use the taskkill utility.
taskkill /PID 8436
If you are using iTerm2 on OSX you can open Toolbelt => ShowToolbelt, select ruby pid 8436 then click send signal to kill it. Occasionally task kill doesn't work for me.
Also, you can ps -aux | grep rails
to find the pid. and then kill like the other answers recommend.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With