Skip to main content

Daemon application help functions.

Project description

Daemon application help functions.


pip install daemon-application


import time
import threading
import signal
from daemon_application import daemon_start

stopflag = False

def main():
    def on_exit(*args, **kwargs):
        with open("backgroud.log", "a", encoding="utf-8") as fobj:
            print("process got exit signal...", file=fobj)
            print(args, file=fobj)
            print(kwargs, file=fobj)
        global stopflag
        stopflag = True
    signal.signal(signal.SIGTERM, on_exit)
    signal.signal(signal.SIGINT, on_exit)
    while not stopflag:

if __name__ == "__main__":
    print("start background application...")
    daemon_start(main, "", True)

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 daemon-application, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size daemon-application-0.2.1.tar.gz (3.6 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 SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page