Skip to main content

Well behaved unix daemons for every occasion.

Project description

Well behaved unix daemons for every occasion.

What Is Daemons?

Daemons is a resource library for Python developers that want to create daemon processes.

The idea is to provide the basic daemon functionality while still giving the developer the ability to customize their daemon for any purpose.

Simply import, extend, and start().

Show Me

#!/usr/bin/python

import sys
import logging
import time

from daemons.base import Daemon


class SleepyDaemon(Daemon):

    def run(self):

        while True:

            time.sleep(1)


if __name__ == '__main__':

    action = sys.argv[1]

    logging.basicConfig(filename="daemon.log", level=logging.DEBUG)
    d = SleepyDaemon(pidfile='daemon.pid')

    if action == "start":

        d.start()

    elif action == "stop":

        d.stop()

    elif action == "restart":

        d.restart()

What else does it do?

The daemon classes in this package are simply meant to provide a base for building custom daemons. None of them “do” anything on their own. All daemons define a set of methods that can be overwritten to provide any amount of custom functionality.

Built in to each daemon class is:

  • Pidfile management.

  • Signal trapping.

  • Logging output using Python’s standard lib “logging” module.

License

Copyright 2013 Kevin Conway

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Contributing

All contributions to this project are protected under the agreement found in the CONTRIBUTING file. All contributors should read the agreement but, as a summary:

You give us the rights to maintain and distribute your code and we promise
to maintain an open source distribution of anything you contribute.

Project details


Download files

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

Source Distribution

daemons-0.2.1.tar.gz (17.6 kB view details)

Uploaded Source

File details

Details for the file daemons-0.2.1.tar.gz.

File metadata

  • Download URL: daemons-0.2.1.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for daemons-0.2.1.tar.gz
Algorithm Hash digest
SHA256 fa5da04820a73ee63349db01fb18f2088d1f6d90cc38f342dcd5d82718422a74
MD5 697f16e0a268aa74ca092dd2ce9f5710
BLAKE2b-256 b209d9fe42fe85e308765a44ef8d66e6714d235feb1aba581d2f9fb4f4a21d89

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page