After starting the server with rails s
, if you exit the terminal without exiting with Ctrl + C
, the following error will occur at the next startup.
$ rails s
=> Booting Puma
=> Rails 5.0.4 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
A server is already running.Check project name/tmp/pids/server.pid.
Exiting
$ lsof -ni tcp:3000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ruby 77464 d0ne1s 20u IPv4 0xe8bde147dfa7a793 0t0 TCP 127.0.0.1:hbci (LISTEN)
ruby 77464 d0ne1s 22u IPv6 0xe8bde147d9f527d3 0t0 TCP [::1]:hbci (LISTEN)
$ kill -9 77464
lsof
: Command to list open files
-n
: Display the IP address (does not resolve the name)
-i
: Specify the port number and protocol
kill
: kill the process
-9
: Forced termination
When Rails s process doesn't break [Lsof] command-list open files
Recommended Posts