pid

Library for managing pidfiles. It was extracted from Kenneth Kalmer’s excellent daemon-kit project (github.com/kennethkalmer/daemon-kit). The daemon-kit framework is amazing for bootstrapping your daemons, but if you need something more lightweight (e.g., a single file daemon), then you’re out of luck (for now). In the mean time, there weren’t any obvious, simple pid file management libraries that you could trust. This one works well and has facilities to ensure the process the pid file is pointing to is still running, so you can handle stale pid files easily.

Usage

Some samples of the most common uses:

require 'rubygems'
require 'pid'

Pid.running?("/path/to/your.pid") # pid filepath
Pid.running?(pid) # the pid of process