Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby Daemons Library with the Daemons.Run function #8

Open
thuehlinger opened this issue May 18, 2014 · 3 comments
Open

Ruby Daemons Library with the Daemons.Run function #8

thuehlinger opened this issue May 18, 2014 · 3 comments
Labels
Milestone

Comments

@thuehlinger
Copy link
Owner

Hello Thomas,

I've been developing a back-end server system in ruby and I was using your awesome Daemonization library seen at http://daemons.rubyforge.org/. One of the issues I am hitting is that when I execute the Daemons.run(script) method the process launches and is daemonized but the rest of the script stops running. For a full example please see: http://pastebin.com/PAwKX6RN

This seems like it might be a limitation of forking in Ruby but if I am utilizing your library incorrectly or you have any insight on how I could get my desired end result I appreciate any input.

Thanks,
Michael Brune

@sodabrew
Copy link
Contributor

Is this all the text that's available? Was there a RubyForge ticket ID associated with this message?

@thuehlinger
Copy link
Owner Author

The Markdown parsing somehow didn't parse the second part of the text correctly. Now fixed. This is what I responded:

Hi Michael,

what you are seeing is the intended behavior of Daemons.run, i.e. it passes all control to the given script.It is — in fact — not a a limitation of the fork comman.
You can achieve your desired behavior by doing another fork on your on within the loop before calling Daemons.run.
Alternatively, you could use Daemons.call to call and daemonize a proc, and then use “load” within the proc to execute the script.
See the examples directory within the gem to get some more guidance.

Btw: daemons has moved to https://github.com/thuehlinger/daemons since rubyforge is shutting down soon.

Best,

Thomas

@sodabrew
Copy link
Contributor

sodabrew commented Jun 1, 2014

What do you think of my suggested program flow in #5 (comment) - I think that would cover his use case for managing workers within his program.

@thuehlinger thuehlinger added this to the 1.3.0 milestone Mar 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants