__init__.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # daemon/__init__.py
  2. # Part of ‘python-daemon’, an implementation of PEP 3143.
  3. #
  4. # This is free software, and you are welcome to redistribute it under
  5. # certain conditions; see the end of this file for copyright
  6. # information, grant of license, and disclaimer of warranty.
  7. """ Library to implement a well-behaved Unix daemon process.
  8. This library implements the well-behaved daemon specification of
  9. :pep:`3143`, “Standard daemon process library”.
  10. A well-behaved Unix daemon process is tricky to get right, but the
  11. required steps are much the same for every daemon program. A
  12. `DaemonContext` instance holds the behaviour and configured
  13. process environment for the program; use the instance as a context
  14. manager to enter a daemon state.
  15. Simple example of usage::
  16. import daemon
  17. from spam import do_main_program
  18. with daemon.DaemonContext():
  19. do_main_program()
  20. Customisation of the steps to become a daemon is available by
  21. setting options on the `DaemonContext` instance; see the
  22. documentation for that class for each option.
  23. """
  24. from .daemon import DaemonContext
  25. __all__ = ['DaemonContext']
  26. # Copyright © 2009–2024 Ben Finney <ben+python@benfinney.id.au>
  27. # Copyright © 2006 Robert Niederreiter
  28. #
  29. # This is free software: you may copy, modify, and/or distribute this work
  30. # under the terms of the Apache License, version 2.0 as published by the
  31. # Apache Software Foundation.
  32. # No warranty expressed or implied. See the file ‘LICENSE.ASF-2’ for details.
  33. # Local variables:
  34. # coding: utf-8
  35. # mode: python
  36. # End:
  37. # vim: fileencoding=utf-8 filetype=python :