diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-01-01 16:25:08 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-01-01 16:25:08 +0100 |
commit | b28b4fcd6e9d954643239deed9804db30dd2ef31 (patch) | |
tree | b2c87e2275121944cfa01cfdbe3f10d322d39305 /pyLoadCore.py | |
parent | closed #200 (diff) | |
download | pyload-b28b4fcd6e9d954643239deed9804db30dd2ef31.tar.xz |
fixed daemon mode
Diffstat (limited to 'pyLoadCore.py')
-rwxr-xr-x | pyLoadCore.py | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/pyLoadCore.py b/pyLoadCore.py index eb990bab7..f3c9bef6c 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -889,13 +889,8 @@ def deamon(): print >>sys.stderr, "fork #2 failed: %d (%s)" % (e.errno, e.strerror) sys.exit(1) - from resource import getrlimit, RLIMIT_NOFILE, RLIM_INFINITY # Resource usage information. - maxfd = getrlimit(RLIMIT_NOFILE)[1] - if maxfd == RLIM_INFINITY: - maxfd = 1024 - - # Iterate through and close all file descriptors. - for fd in range(0, maxfd): + # Iterate through and close some file descriptors. + for fd in range(0, 3): try: os.close(fd) except OSError: # ERROR, fd wasn't open to begin with (ignored) @@ -914,12 +909,12 @@ if __name__ == "__main__": if "--daemon" in sys.argv: deamon() - - pyload_core = Core() - try: - pyload_core.start() - except KeyboardInterrupt: - pyload_core.shutdown() - pyload_core.log.info(_("killed pyLoad from Terminal")) - pyload_core.removeLogger() - _exit(1) + else: + pyload_core = Core() + try: + pyload_core.start() + except KeyboardInterrupt: + pyload_core.shutdown() + pyload_core.log.info(_("killed pyLoad from Terminal")) + pyload_core.removeLogger() + _exit(1) |