aboutsummaryrefslogtreecommitdiff
path: root/grs
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2015-07-02 18:32:51 -0400
committerAnthony G. Basile <blueness@gentoo.org>2015-07-02 18:32:51 -0400
commit10a308cef6fecb1d8e3b4ffd932f79d5020bec85 (patch)
tree55c5b77611ba428feb0dea4ca9736d4a00b1578e /grs
parentmake-worldconf: sort the sections of world.conf. (diff)
downloadgrss-10a308cef6fecb1d8e3b4ffd932f79d5020bec85.tar.gz
grss-10a308cef6fecb1d8e3b4ffd932f79d5020bec85.tar.bz2
grss-10a308cef6fecb1d8e3b4ffd932f79d5020bec85.zip
Daemon.py: add kudos.
Diffstat (limited to 'grs')
-rw-r--r--grs/Daemon.py4
1 files changed, 3 insertions, 1 deletions
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-<pid>.err
+ # Dup stdin to /dev/null, and stdout and stderr to grs-daemon-<pid>.err
si = open(os.devnull, 'r')
os.dup2(si.fileno(), sys.stdin.fileno())