Can't stop rails server

前端 未结 27 2225
别跟我提以往
别跟我提以往 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:35

    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.

    Updated answer:

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

    killall -9 rails

提交回复
热议问题