Go to file
Ilya Otyutskiy 7d256cc400 Merge pull request #2 from knsd/master
Fixed tests for travis ci
2013-03-24 07:31:54 -07:00
2013-03-24 18:20:23 +04:00
2012-09-01 02:25:25 +04:00
2012-09-24 19:26:51 +04:00
2012-09-24 19:26:51 +04:00
2012-09-24 19:26:51 +04:00

daemonize

Description

daemonize is a library for writing system daemons in Python. It has some bits from daemonize.sourceforge.net. It is distributed under MIT license.

Build Status

Installation

You can install it from Python Package Index (PyPI):

$ pip install daemonize

Usage

from time import sleep
from daemonize import Daemonize

pid = "/tmp/test.pid"


def main():
    while True:
        sleep(5)

daemon = Daemonize(app="test_app", pid=pid, action=main)
daemon.start()

File descriptors

Daemonize object's constructor understands the optional argument keep_fds which contains a list of FDs which should not be closed. For example:

import logging
from daemonize import Daemonize

pid = "/tmp/test.pid"
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger.propagate = False
fh = logging.FileHandler("/tmp/test.log", "w")
fh.setLevel(logging.DEBUG)
logger.addHandler(fh)
keep_fds = [fh.stream.fileno()]


def main():
    logger.debug("Test")

daemon = Daemonize(app="test_app", pid=pid, action=main, keep_fds=keep_fds)
daemon.start()
Description
RETIRED, further work has moved to Debian project infrastructure
Readme 143 KiB
Languages
Python 99.1%
Makefile 0.9%