Skip to main content
Help us improve Python packaging – donate today!

Lightweight Python module for daemonizing

Project Description

Travis build status image Coverage status

succubus

Description

succubus is a lightweight python module for a fast and easy creation of python daemons and init scripts.

Examples

#!/usr/bin/env python

import logging
import sys
import time

from logging.handlers import WatchedFileHandler

from succubus import Daemon


class MyDaemon(Daemon):
    def run(self):
        """Overwrite the run function of the Daemon class"""
        while True:
            time.sleep(1)
            self.logger.warn('Hello world')

    def setup_logging(self):
        # TODO: don't log to /tmp except for example code
        handler = WatchedFileHandler('/tmp/succubus.log')
        self.logger = logging.getLogger('succubus')
        self.logger.addHandler(handler)


def main():
    daemon = MyDaemon(pid_file='succubus.pid')
    sys.exit(daemon.action())


if __name__ == '__main__':
    main()

Succubus implements the usual init script actions (start, stop, restart, status) in Python. So your init script can look like this:

#!/bin/bash
/usr/bin/my_succubus_daemon $1 --foo=42

If the init script is called as /etc/init.d/my_succubus_daemon start, this will translate into /usr/bin/my_succubus_daemon start --foo=42 being called. The start parameter is consumed by the succubus framework, i.e. when your code does the command line parsing, it looks as if /usr/bin/my_succubus_daemon --foo=42 was called. You can now parse the --foo=42 parameter as you please.

Release history Release notifications

History Node

1.0.post246

History Node

1.0.post245

History Node

1.0.post244

History Node

1.0.post243

History Node

1.0.post242

History Node

1.0.post241

History Node

1.0.post240

History Node

1.0.post239

History Node

1.0.post238

History Node

1.0.post237

History Node

1.0.post236

History Node

1.0.post235

History Node

1.0.post234

History Node

1.0.post233

History Node

1.0.post232

History Node

1.0.post230

History Node

1.0.post228

History Node

1.0.post227

History Node

1.0.post226

History Node

1.0.post225

History Node

1.0.post224

History Node

1.0.post223

History Node

1.0.post222

History Node

1.0.post221

History Node

1.0.post220

History Node

1.0.post219

History Node

1.0.post218

History Node

1.0.post217

History Node

1.0.post216

History Node

1.0.post215

History Node

1.0.post214

History Node

1.0.post213

History Node

1.0.post212

History Node

1.0.post211

History Node

1.0.post210

History Node

1.0.post209

History Node

1.0.post208

History Node

1.0.post207

History Node

1.0.post205

History Node

1.0.post204

This version
History Node

1.0.post75

History Node

1.0.post74

History Node

1.0.post73

History Node

1.0.post72

History Node

1.0.post71

History Node

1.0.post70

History Node

1.0.post69

History Node

1.0.post68

History Node

1.0.post67

History Node

1.0.post66

History Node

1.0.post65

History Node

1.0.post64

History Node

1.0.post63

History Node

1.0.post62

History Node

1.0.post61

History Node

1.0.post60

History Node

1.0.post59

History Node

1.0.post58

History Node

1.0.post57

History Node

1.0.post56

History Node

1.0-55

History Node

1.0-54

History Node

1.0-53

History Node

1.0-52

History Node

1.0-51

History Node

1.0-50

History Node

1.0-49

History Node

1.0-48

History Node

1.0-47

History Node

1.0-46

History Node

1.0-45

History Node

1.0-38

History Node

1.0-37

History Node

1.0-36

History Node

1.0-35

History Node

1.0-34

History Node

1.0-33

History Node

1.0-31

History Node

1.0-30

History Node

1.0-29

History Node

1.0-28

History Node

1.0-27

History Node

1.0-26

History Node

1.0-25

History Node

1.0-24

History Node

1.0-22

History Node

1.0-21

History Node

1.0-20

History Node

1.0-19

History Node

1.0-18

History Node

1.0-17

History Node

1.0-15

History Node

1.0-14

History Node

1.0-13

History Node

1.0-12

History Node

1.0-11

History Node

1.0-10

History Node

1.0-9

History Node

1.0-8

History Node

1.0-7

History Node

1.0-6

History Node

1.0-5

History Node

1.0-4

History Node

1.0-3

History Node

1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
succubus-1.0.post75.tar.gz (4.5 kB) Copy SHA256 hash SHA256 Source None Jun 19, 2017

Supported by

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