[LINUX] What to do if rails s doesn't work

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

Workaround

$ 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

reference

When Rails s process doesn't break [Lsof] command-list open files

Recommended Posts

What to do if rails s doesn't work
What to do if atom autocomplete-python doesn't work
What to do if intellisense doesn't work with Anaconda + VSCode + Tensorflow2.1
Let's Encrypt updated! What to do if the certbot renew command doesn't work
What to do if scrapy doesn't work after installing scrapy with pip on mac
What to do to get tensorflow-gpu to work
What to do if pipreqs results in UnicodeDecodeError
What to do if you can't pipenv shell
Note: What to do if pip install fails
What to do if the server doesn't start with python manage.py runserver
What to do if pip cannot be installed
What to do if Docker-sync suddenly stops working
What to do if "amazon-linux-extras" → "No module named amazon_linux_extras"
What to do if the latest Jupyter Notebook and nb extensions don't work
What to do if pip install fails in Xcode 5.1
What to do if you can't pip install mysqlclient
No module named What to do if you get'libs.resources'
ModuleNotFoundError: No module What to do if you get'tensorflow.contrib'
What to do if SciPy installation fails on CentOS
What to do if a UnicodeDecodeError occurs in pip
What to do if pip install fails to install dependent libraries
What to do if sys / cdefs.h does not exist
What to do if pyenv is not enabled (zsh)
What to do if you are addicted to Windows character code
What to do if pip gives a DistributionError in Homebrew
TypeError: unsupported operand type (s) for-: What to do when'datetime.time'and'datetime.time'
What to do if you get "coverage unknown" in Coveralls
What to do if you can't sort files with subscripts
What to do if a 0xC0000005 error occurs in tf.train.start_queue_runners ()
What to do if package installation fails when deploying to heroku
What to do if `pip install matplotlib` fails on Mac
What to do if you can't log in as root
What to do if you can't use WiFi on Linux
What to do if Linux VLC can no longer rotate
What to do if pip install mysqlclient fails on MacOS
What to do if you lose your EC2 key pair
What to do when Ubuntu crashes
What to do with Magics install
module install if pip install doesn't work
What to do with PYTHON release?
What to do if you can't install pyaudio with pip #Python
What to do if you get a minus zero in Python
What to do if you get a UnicodeDecodeError with pip install
What to do if Insecure Platform Warning appears when running Python
What to do if "Unnamed: 0" is added in to_csv-> read_csv in pandas
What to do if the inode is exhausted on EC2 Linux
What to do if you can't build your project with Maven
What to do if PyAudio cannot be installed on Python 3.7, 3.8, 3.9 on Windows
What to do if you can't use the trash in Lubuntu 18.04.
Django: What to do if TemplateDoesNotExist at / admin / after setting templates
What to do if grep: empty (sub) expression appears on Mac grep
What to do if you can't find well with grep's -f option
What to do if there is a decimal in python json .dumps
What to do if you can't find PDO in Laravel or CakePHP
What to do if the Pipenv environment is corrupted by updating Homebrew
What to do if you couldn't send an email to Yahoo with Python.
What to do if you can't use scikit grid search in Python
What to do if ipython and python start up with different versions
What to do if you have installed PyCharm but shortcut keys such as `control + e` do not work
What to do if your disk runs out due to MySQL binary logs
What to do if you forget your login password on Manjaro Linux