Well, I did it myself anyway. Hope it's useful:
http://rubyforge.org/projects/pidify/

-Payton

Payton Swick wrote:
> Has anyone used the Daemons library (http://daemons.rubyforge.org/) 
> extensively?  I'm trying to do something that doesn't appear covered by 
> the examples, and I'm wondering if I need to reinvent the wheel.
> 
> What I'd like to do is to easily add functionality to my script similar 
> to the way that fetchmail works, ie:
> 
> When starting the script with one command-line option (eg: --daemon), I 
> daemonize it and start it running (saving the PID in a file).
> 
> When starting the script with another command-line option (eg: --stop), 
> it finds the PID file and kills the instance.
> 
> In a sense, I'd like to combine the wrapper method given in the examples 
> and the script it runs, but the wrapper example seems to absorb 
> command-line options, and I want to call those functions from within 
> Ruby instead.
> 
> Suggestions?
> 
> -Payton