Daemon application help functions.
Project description
daemon-application
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)
Release
v0.3.0 2020/11/21
- New wrapper.
v0.2.1 2018/04/18
- Old releases.
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.3.0.tar.gz
.
File metadata
- Download URL: daemon-application-0.3.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c03e66ad74f38d926b694a2789d1719b4b81873c06ee5b4b390f68e34384e09 |
|
MD5 | 40b6b6fb96e0765ea3804a7b74097810 |
|
BLAKE2b-256 | 89ef67e00c6b1252cb03199e7664df3393edf8e06011fcf5e7bc382acd146cd0 |