aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-01-01 16:42:52 +0100
committerKim Alvefur <zash@zash.se>2019-01-01 16:42:52 +0100
commited06f22ae5f6ff73c21d82e583248f0096cb096f (patch)
tree7bde8bff8db2fefb9d3523fbb7d3b5c74f474d2b /util
parentf9478ab242518fede7c09928817028d768997068 (diff)
downloadprosody-ed06f22ae5f6ff73c21d82e583248f0096cb096f.tar.gz
prosody-ed06f22ae5f6ff73c21d82e583248f0096cb096f.zip
prosody: Move last cleanup and shutdown code into util.startup
Diffstat (limited to 'util')
-rw-r--r--util/startup.lua16
1 files changed, 16 insertions, 0 deletions
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";