Can't stop rails server

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

    When the rails server does not start it means that it is already running then you can start by using new port eg.

    rails s -p 3001
    

    or it starts and stops in that case you want to delete temp folder in rails directory structure it starts the rails server.

    0 讨论(0)
  • 2020-12-04 05:32
    1. Just open the file using the location given sudo vi /Users/user1/go/src/github.com/rails_app/rails_project/tmp/pids/server.pid

    2. find the process_id / thread_id at which the process is runnning.

    3. Kill the specified process / thread using kill -9 84699

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

    I have noticed on Windows (Im using 10 but not sure if the same for oler). If you use cmd.exe and ctrl + c the raisl server stops correctly.

    However, if you use Git Bash, it doesn't. It says it has but when you look at the tmp pids, its still there.

    Maybe a bug with git bash?

    0 讨论(0)
  • 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

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

    Press Ctrl - C it will stop
    if not check

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

    Ctrl-Z should normally do the trick.

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