Can't stop rails server

前端 未结 27 1963
别跟我提以往
别跟我提以往 2020-12-04 05:12

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

相关标签:
27条回答
  • 2020-12-04 05:39

    I used killall -9 rails like Sri suggested and it didn't work. I adjusted the command to killall -9 ruby and the server closed immediately.

    Tl;dr: killall -9 ruby

    0 讨论(0)
  • 2020-12-04 05:39

    check the /tmp/tmp/server.pid

    there is a pid inside.

    Usually, I ill do "kill -9 THE_PID" in the cmd

    0 讨论(0)
  • 2020-12-04 05:39

    For my windows 10 machine, Ctrl - C + Ctrl - D works.

    0 讨论(0)
  • 2020-12-04 05:39

    We can kill rails session on Linux using PORT no

    fuser -k 3000/tcp 
    

    here 3000 is a port no. Now restart your server, you will see your server is in running state.

    0 讨论(0)
  • 2020-12-04 05:40

    If you are using a more modern version of Rails and it uses Puma as the web server, you can run the following command to find the stuck Puma process:

    ps aux | grep puma
    

    It will result in output similar to this:

    85923 100.0  0.8  2682420 131324 s004  R+    2:54pm   3:27.92 puma 3.12.0 (tcp://0.0.0.0:3010) [my-app]
    92463   0.0  0.0  2458404   1976 s008  S+    3:09pm   0:00.00 grep puma
    

    You want the process that is not referring to grep. In this case, the process ID is 85923.

    I can then run the following command to kill that process:

    kill -9 85923
    

    0 讨论(0)
  • 2020-12-04 05:42

    killall -9 ruby will kill all the ruby processes, and at-least on my machine, rails servers appear as ruby processes. killall -9 rails is much more specific and doesn't work for older versions of rails servers (it gives a 'rails:no process found' because the process is named ruby)

    Encountered this problem a while ago. After submitting a form in activeadmin, the rails server just hanged and I was unable to kill it using normal means (even after ctrl+z it was still running in the background). Learner's answer helped, but this command doesn't need process id.

    0 讨论(0)
提交回复
热议问题