Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

A server is already running

Writer Andrew Henderson

I'm currently using cloud 9 for this project. When I run it using rails server -b $IP -p $PORt it gives me this:

=> Booting Puma
=> Rails 5.0.0 application starting in development on
=> Run `rails server -h` for more startup options
A server is already running. Check /home/ubuntu/workspace/saasapp/tmp/pids/server.pid.
Exiting

Does anyone know how to fix this? I already tried closing and re-opening the tabs again, and stop running the run project button. The language is ruby-on-rails and I'm sort of a beginner.

2

3 Answers

The error is happening because you most likely started your server, then closed the terminal before closing the server. I also had that error, but what I did was that I clicked the memory cpu disk icon on the top right corner, then clicked restart, and re-ran my server, and it started. I'm not sure if it's the proper way, but I was following a tutorial and that's what they showed.

This happens when you close the terminal tab before ending Rails.

To end Rails, find its process ID with lsof, then kill it:

lsof -i tcp:8080
[copy the PID]
kill -9 [paste PID]
bin/rails s

Alternatively, you can also find the process ID in Puma's temporary files using cat, then kill it:

kill -9 $(cat tmp/pids/server.pid)
bin/rails s

Open this file: /home/ubuntu/workspace/saasapp/tmp/pids/server.pid as it states in the error.
The file should contain the process ID.
Copy the ID.
Open the terminal -> and run the command

sudo kill -9 {the copied ID}

Subsequently delete the ID from the server.pid file and try to start the server again

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy