Skip to main content

Zencore daemon application start.

Project description

https://travis-ci.org/appstore-zencore/zdas.svg?branch=master

Zencore daemon application start.

Install

pip install zdas

Usage

import time
import threading
import signal
import zdas

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:
        time.sleep(1)
        print(time.time())

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

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

zdas-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file zdas-0.1.0.tar.gz.

File metadata

  • Download URL: zdas-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for zdas-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2a7fed691b6767c486650569081d6bf3b2685b7309fde986b5ca24be68d1f14d
MD5 c3e0e7c834e3307a8886a322eb3d1ff1
BLAKE2b-256 24fb9a60902b806f4a5c33039c97a35a463e093dcaa69bc3d1d848e851736b52

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