Skip to main content

Daemonizes functions: eject and forget!

Project description

Jetsam

  • True daemonizer using native C calls
  • Currently only compatible with *nix file systems
  • Extra Paranoid Edition uses that double fork magic!

jetsam definition: floating debris ejected from a ship

C Extension

To showcase a C library being used as a native python module

Example

import time
import logging
import jetsam
from jetsam import daemon, end_daemon

jetsam.set_logfile("user_daemon.log")  # defaults to /tmp/jetsam.log

@daemon
def foo():
    logging.basicConfig(
        filename="foo.log", 
        level=logging.DEBUG, 
        filemode="w"
    )
    while True:
        time.sleep(1)
        logging.debug("Truly daemonized!")


foo()  # detaches from current interpreter

time.sleep(3)  # a long running process...

end_daemon(foo)

print("Eject and forget with jetsam!")

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

jetsam-0.1.6.tar.gz (7.1 kB view hashes)

Uploaded Source

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