Reputation: 391
I have a problem when I want to start my server in my terminal I do rail s
or rails server
and there is an error A server is already running. Check /Users/baptiste/code/BaptisteB/my-app/tmp/pids/server.pid.
What does it mean? And why it is present?
I delete it and when I check my localhost:3000
. There is nothing. I have to log off my laptop and turn on it to begin to work.
How could I stop this error? Maybe I can destroy it with a command. Thank you for your help.
Upvotes: 5
Views: 3346
Reputation: 470
Simple:
$ cd # in the project folder
$ gem install shutup
$ shutup
If using rvm do:
$ cd # in the project folder
$ rvm @global do gem install shutup
$ shutup
Upvotes: 1
Reputation: 2927
It means that you have already started a rails server. What's possibly happened is that you started a rails server and closed that terminal window without stopping the server. Open a terminal window and run
ps aux | grep rails
that should give you a list of all the processes running with rails in its name. Then you can run the command below to kill all of them or get the pid (process id) and selectively terminate them with the second command. If you're on wi
killall -9 rails
kill pid
Upvotes: 2
Reputation: 3323
Try to run below command on your terminal and you will get pid (process id)
lsof -wni tcp:3000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ruby 21309 user 11u IPv4 93186 0t0 TCP *:3000 (LISTEN)
and then kill your ruby process by using
kill -9 <PID>
start your server again by rails s
Hope it helps!
Upvotes: 6