Skip to main content

Provides a simple Daemon class to ease the process of forking a python application on Unix systems.

Project description

A fork of Shane Hathaway’s script.


  • reads the command line
  • reads a configuration file
  • configures logging
  • calls root-level setup code
  • drops privileges
  • calls user-level setup code
  • detaches from the controlling terminal
  • checks and writes a pidfile


pip install simpledaemon


Writing a daemon requires creating two files, a daemon file which simply enters an infinite loop and does whatever you want it to do, and a configuration file with the same name which tells simpledaemon how to setup your daemon.

import simpledaemon
import logging
import time

class HelloDaemon(simpledaemon.Daemon):
    default_conf = '/etc/hellodaemon.conf'
    section = 'hello'

    def run(self):
        while True:
  'The daemon says hello')

if __name__ == '__main__':


pidfile = ./
logfile = ./hellodaemon.log
loglevel = info


To use your new daemon, execute your script like so:

./ --start

Stopping is similar:

./ --stop

For a full list of options, see the help:

./ --help


If you come across any bugs in simpledaemon. Kindly file an issue at:

Pull requests are also welcome.

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 SimpleDaemon, version 1.3.0
Filename, size File type Python version Upload date Hashes
Filename, size SimpleDaemon-1.3.0.tar.gz (7.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page