def __init__(self,
pidfile=None,
stdin='/dev/null',
stdout='/dev/null',
stderr='/dev/null',
close_fds=False):
self.stdin = stdin
self.stdout = stdout
self.stderr = stderr
self.pidfile = pidfile or _default_pid_file()
# NOTE: We need to open another separate file to avoid the file
# being reopened again.
# In which case, process loses file lock.
#
# From "man fcntl":
# As well as being removed by an explicit F_UNLCK, record locks are
# automatically released when the process terminates or if it
# closes any file descriptor referring to a file on which locks
# are held. This is bad: it means that a process can lose the locks
# on a file like /etc/passwd or /etc/mtab when for some reason a
# library function decides to open, read and close it.
self.lockfile = self.pidfile + ".lock"
self.lockfp = None
self.close_fds = close_fds
评论列表
文章目录