Skip to main content

Library to enable your code run as a daemon process on Unix-like systems.

Project description

Latest version Travis CI

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


It is tested under following Python versions:

  • 2.6
  • 2.7
  • 3.3
  • 3.4


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

$ pip install daemonize


from time import sleep
from daemonize import Daemonize

pid = "/tmp/"

def main():
    while True:

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

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/"
logger = logging.getLogger(__name__)
logger.propagate = False
fh = logging.FileHandler("/tmp/test.log", "w")
keep_fds = []

def main():

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

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for daemonize, version 2.4
Filename, size File type Python version Upload date Hashes
Filename, size daemonize-2.4.tar.gz (8.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page