From 10a308cef6fecb1d8e3b4ffd932f79d5020bec85 Mon Sep 17 00:00:00 2001 From: "Anthony G. Basile" Date: Thu, 2 Jul 2015 18:32:51 -0400 Subject: Daemon.py: add kudos. --- grs/Daemon.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'grs') diff --git a/grs/Daemon.py b/grs/Daemon.py index 8fed2a1..15290a5 100644 --- a/grs/Daemon.py +++ b/grs/Daemon.py @@ -9,6 +9,8 @@ import time class Daemon: """ doc here more doc + Adopted from Sander Marechal's "A simple unix/linux daemon in Python" + See: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ """ def __init__(self, pidfile, **kwargs): @@ -41,7 +43,7 @@ class Daemon: sys.stderr.write('fork #2 failed %s\n' % err) sys.exit(1) - # Close stdin, and redirect both stdout and stderr to grs-daemon-.err + # Dup stdin to /dev/null, and stdout and stderr to grs-daemon-.err si = open(os.devnull, 'r') os.dup2(si.fileno(), sys.stdin.fileno()) -- cgit v1.2.3-65-gdbad