|
|
@ -21,7 +21,7 @@ def createDaemon():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
pid = os.fork()
|
|
|
|
pid = os.fork()
|
|
|
|
except OSError as e:
|
|
|
|
except OSError as e:
|
|
|
|
raise Exception, "%s [%d]" % (e.strerror, e.errno)
|
|
|
|
raise Exception("%s [%d]" % (e.strerror, e.errno))
|
|
|
|
|
|
|
|
|
|
|
|
if (pid == 0):
|
|
|
|
if (pid == 0):
|
|
|
|
os.setsid()
|
|
|
|
os.setsid()
|
|
|
@ -29,7 +29,7 @@ def createDaemon():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
pid = os.fork()
|
|
|
|
pid = os.fork()
|
|
|
|
except OSError as e:
|
|
|
|
except OSError as e:
|
|
|
|
raise Exception, "%s [%d]" % (e.strerror, e.errno)
|
|
|
|
raise Exception("%s [%d]" % (e.strerror, e.errno))
|
|
|
|
|
|
|
|
|
|
|
|
if (pid == 0):
|
|
|
|
if (pid == 0):
|
|
|
|
os.chdir(WORKDIR)
|
|
|
|
os.chdir(WORKDIR)
|
|
|
@ -45,7 +45,7 @@ def createDaemon():
|
|
|
|
maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
|
|
|
|
maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
|
|
|
|
if (maxfd == resource.RLIM_INFINITY):
|
|
|
|
if (maxfd == resource.RLIM_INFINITY):
|
|
|
|
maxfd = MAXFD
|
|
|
|
maxfd = MAXFD
|
|
|
|
|
|
|
|
|
|
|
|
for fd in range(0, maxfd):
|
|
|
|
for fd in range(0, maxfd):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
os.close(fd)
|
|
|
|
os.close(fd)
|
|
|
|