From 33e7e5ef2d5e97b45cd9bcb56ce5ec6adc3a66c9 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Tue, 8 Sep 2020 22:50:43 +0200
Subject: mod_posix: Daemonize later

Daemonizing later means we can use that as a "successful startup"
signal and problems can be reported via exit code.
---
 plugins/mod_posix.lua | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

(limited to 'plugins')

diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua
index 0a658009..d3ff1f7c 100644
--- a/plugins/mod_posix.lua
+++ b/plugins/mod_posix.lua
@@ -117,9 +117,7 @@ if daemonize then
 			write_pidfile();
 		end
 	end
-	if not prosody.start_time then -- server-starting
-		daemonize_server();
-	end
+	module:hook("server-started", daemonize_server)
 else
 	-- Not going to daemonize, so write the pid of this process
 	write_pidfile();
-- 
cgit v1.2.3