Kill a process from PID file

Some applications create a PID file - a file that stores the process identifier of the application. The Mongrel server (and I think WEBrick too) creates a PID file in an application’s root directory at e.g. [app]/tmp/pids/mongrel.pid.

You can use the cat command to pass the PID from this file to the kill command in order to terminate the process gracefully.

kill -TERM $(cat tmp/pids/mongrel.pid)

Or send a kill signal, which forces the termination:

kill -KILL $(cat tmp/pids/mongrel.pid)
kill -9 $(cat tmp/pids/mongrel.pid)

Last modified: 28/01/2012 Tags: , ,

Related Pages

Other pages possibly of interest:

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top