Daemon application help functions.
Project description
Daemon application help functions.
Install
pip install daemon-application
Usage
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: time.sleep(1) print(time.time()) if __name__ == "__main__": print("start background application...") daemon_start(main, "background.pid", True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file daemon-application-0.2.0.tar.gz
.
File metadata
- Download URL: daemon-application-0.2.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4eae654036a6b5f5f77204d5956360dcaefe2a89782b40294ba2b795ac155e7a |
|
MD5 | daf5938db19bdeeb9ad7c37a074934e7 |
|
BLAKE2b-256 | 8f6c38c0496100b177d8ae5ab2cf10406b3b25c5ec09815bc30d007de9dbe71e |