aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xprosody14
-rw-r--r--util/startup.lua16
2 files changed, 17 insertions, 13 deletions
diff --git a/prosody b/prosody
index 164d0f94..f45e9ecb 100755
--- a/prosody
+++ b/prosody
@@ -78,18 +78,6 @@ local function loop()
end
end
-local function cleanup()
- prosody.log("info", "Shutdown status: Cleaning up");
- prosody.events.fire_event("server-cleanup");
-end
-
loop();
-prosody.log("info", "Shutting down...");
-cleanup();
-prosody.events.fire_event("server-stopped");
-prosody.log("info", "Shutdown complete");
-
-prosody.log("debug", "Shutdown reason was: %s", prosody.shutdown_reason or "not specified");
-prosody.log("debug", "Exiting with status code: %d", prosody.shutdown_code or 0);
-os.exit(prosody.shutdown_code, true);
+startup.shutdown();
diff --git a/util/startup.lua b/util/startup.lua
index 2d06f783..ce14df71 100644
--- a/util/startup.lua
+++ b/util/startup.lua
@@ -624,6 +624,22 @@ function startup.make_dummy_hosts()
end
end
+function startup.cleanup()
+ prosody.log("info", "Shutdown status: Cleaning up");
+ prosody.events.fire_event("server-cleanup");
+end
+
+function startup.shutdown()
+ prosody.log("info", "Shutting down...");
+ startup.cleanup();
+ prosody.events.fire_event("server-stopped");
+ prosody.log("info", "Shutdown complete");
+
+ prosody.log("debug", "Shutdown reason was: %s", prosody.shutdown_reason or "not specified");
+ prosody.log("debug", "Exiting with status code: %d", prosody.shutdown_code or 0);
+ os.exit(prosody.shutdown_code);
+end
+
-- prosodyctl only
function startup.prosodyctl()
prosody.process_type = "prosodyctl";