mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-01 18:18:31 +00:00
Decouple the daemon from its parent environment
This commit is contained in:
parent
3a9238f670
commit
ecb8ad747e
1 changed files with 4 additions and 0 deletions
|
@ -114,6 +114,10 @@ def run():
|
||||||
if config.get("server", "pid"):
|
if config.get("server", "pid"):
|
||||||
with os.fdopen(pid_fd, "w") as pid_file:
|
with os.fdopen(pid_fd, "w") as pid_file:
|
||||||
pid_file.write(str(os.getpid()))
|
pid_file.write(str(os.getpid()))
|
||||||
|
# Decouple environment
|
||||||
|
os.umask(0)
|
||||||
|
os.chdir("/")
|
||||||
|
os.setsid()
|
||||||
sys.stdout = sys.stderr = open(os.devnull, "w")
|
sys.stdout = sys.stderr = open(os.devnull, "w")
|
||||||
|
|
||||||
# Register exit function
|
# Register exit function
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue