Commit cc564deb authored by Karl Fleischmann's avatar Karl Fleischmann

Add daemon-module

* Outsource forking-routines to own module
parent decb8120
# -*- coding: utf-8 -*-
import os
import sys
class Daemon(object):
"""Daemon class for usage in background."""
def __init__(self, args):
""""""
self.args = args
def start(self):
"""Start daemonizing this program."""
print("hack_count started in daemon-mode (printing disabled)...")
self.args.printing = False
try:
pid = os.fork()
if pid > 0:
# exit first parent
sys.exit(0)
except OSError:
sys.stderr.write("fork failed")
sys.exit(1)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment