views:

2038

answers:

3

Hi

I am running my rails application using the following

  $script/server -d webrick

on my Ubuntu system , above command run the webrick server in background . I could kill the process using kill command

  $kill pid

Does rails provide any command to stop the background running daemon server ?

like the one provided by rails to start the server , Thanks .

EDIT When it is appropriate to start the daemon server ? Any real time scenario will help Thanks

+1  A: 

i don't think it does if you use -d. I'd just kill the process.

In the future, just open up another terminal window instead and use the command without -d, it provides some really useful debugging output.

If this is production, use something like passenger or thin, so that they're easy to stop the processes or restart the servers

+1  A: 

The process id of the daemon server is stored in your application directory tmp/pids/. You can use your standard kill process_id with the information you find there.

Ryan
+4  A: 

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.