mirror of
https://github.com/Kozea/Radicale.git
synced 2025-07-23 17:48:30 +00:00
Refactor: Extract daemonize function
This commit is contained in:
parent
a94a3bc7c2
commit
79bcedd4bc
1 changed files with 7 additions and 3 deletions
|
@ -114,9 +114,8 @@ def run():
|
|||
exit(1)
|
||||
|
||||
|
||||
def serve(configuration, logger):
|
||||
"""Serve radicale from configuration."""
|
||||
# Fork if Radicale is launched as daemon
|
||||
def daemonize(configuration, logger):
|
||||
"""Fork and decouple if Radicale is configured as daemon."""
|
||||
if configuration.getboolean("server", "daemon"):
|
||||
# Check and create PID file in a race-free manner
|
||||
if configuration.get("server", "pid"):
|
||||
|
@ -153,6 +152,11 @@ def serve(configuration, logger):
|
|||
os.unlink(configuration.get("server", "pid"))
|
||||
|
||||
atexit.register(cleanup)
|
||||
|
||||
|
||||
def serve(configuration, logger):
|
||||
"""Serve radicale from configuration."""
|
||||
daemonize(configuration, logger)
|
||||
logger.info("Starting Radicale")
|
||||
|
||||
# Create collection servers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue