How to stop a Daemon Server in Rails?

Like Ryan said:

the pid you want is in tmp/pids/

probably server.pid is the file you want.

You should be able to run kill -9 $(cat tmp/pids/server.pid) to bring down a daemonized server.


if it can be useful, on linux you can find which process is using a port (in this case 3000) you can use:

lsof -i :3000

it'll return the pid too


How about a rake task?

desc 'stop rails'
task :stop do
    pid_file = 'tmp/pids/server.pid'
    pid = File.read(pid_file).to_i
    Process.kill 9, pid
    File.delete pid_file
end

run with rake stop or sudo rake stop