Add the ability to daemonize #79

Closed
wants to merge 5 commits into
from

2 participants

@joejulian

Add the ability to run in the background with the -D or --daemon command line option.

This patch looks really ugly as diff tried matching up lines that didn't actually match. All that really happened is most of the code was indented to create the main() function.

@josegonzalez
python-beaver member

I'm going to hold off on this for a bit, since i have some major changes to introduce regarding multiprocessing etc. that will definitely impact this.

Why don't you use something else to daemonize beaver? I would rather have something like init.d, supervisor, circus etc. handle the state of the beaver command than have custom code for daemonization...

Does this work on Python 2.6?

@josegonzalez
python-beaver member

Might you be able to rebase this on top of the latest master branch? I'd like to get this out in the next beaver release if possible.

@joejulian

The red hat init.d functions don't have a way of backgrounding a service and expects a daemon to run in the background. There are workarounds, but having the daemon behave in an anticipated way is preferred.

It does work on 2.6 and yes, I'll rebase.

@josegonzalez
python-beaver member

Hey @joejulian, I added the ability to daemonize as part of a general refactor. This should work the same way as your method, except I added a bit of extra code to handle stdout to a file - was missing since it wasn't otherwise specified as a handler.

Let me know if you have any problems with it by opening a separate issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment