Ruby daemon process to keep objects alive for transient Ruby instances
You're probably looking for something like memcache (Gem) or redis (Gem).
You may also be interested in redis-objects.
So, who should daemonize? The script or the caller?
You probably cannot get a definitive answer, as we generally end up with both: the process has the ability to daemonize itself, and the process monitor has the ability to daemonize its children.
Personally I prefer to have the process monitor or script do it, for a few reasons:
1. if the process monitor wishes to closely follow its children to restart them if they die, it can choose not to daemonize them. A SIGCHLD will be delivered to the monitor when one of its child processes exits. In embedded systems we do this a lot.
2. Typically when daemonizing, you also set the euid and egid. I prefer not to encode into every child process a knowledge of system-level policy like uids to use.
3. It allows re-use of the same application as either a command line tool or a daemon (I freely admit that this rarely happens in practice).
Related Topics
Ruby Parenthesis Syntax Exception with I++ ++I
Ruby on Rails - £ Sign Troubles
"Bad Ecpoint" Ssl Error on Fresh Rvm Ruby 1.9.3 Install on Osx Mountain Lion
How to Ignore File Types in a Web Crawler
How to Split String into 2 Parts After Certain Position
Can Anyone Explain This Array Declaration to Me
How to Efficiently Extract Repeated Elements in a Ruby Array
Rvm and Gems, Bundle Show and Gem List
Incompatible Character Encoding in Rails - How to Just Fail/Skip Sensibly
Trouble on Eager Loading "Second Degree" Associated Objects
How to Access Text Field in an Iframe
No Such File or Directory @ Rb_Sysopen for External Url/Rails 6.11/Ruby 3
How to Spec Methods That Exit or Abort
Why Doesn't Array Override the Triple Equal Sign Method in Ruby