aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-05-05 14:17:06 +0100
committerMatthew Wild <mwild1@gmail.com>2009-05-05 14:17:06 +0100
commitbff3101d36f42871243f3190808f3b1eeb0c13f4 (patch)
tree7c59d4da7ed92c0619cff6ee7295c5072f0e721f
parent264c83dbd9a515de6fde79de746a7a4fe3f6fd55 (diff)
downloadprosody-bff3101d36f42871243f3190808f3b1eeb0c13f4.tar.gz
prosody-bff3101d36f42871243f3190808f3b1eeb0c13f4.zip
prosody: Add functions to reload the config and re-open log files
-rwxr-xr-xprosody22
1 files changed, 21 insertions, 1 deletions
diff --git a/prosody b/prosody
index 8b6b8ae6..2febe4d8 100755
--- a/prosody
+++ b/prosody
@@ -114,7 +114,27 @@ end);
----------- End of out-of-place code --------------
--- Global function to initiate prosody shutdown
+-- Function to reload the config file
+function prosody_reload_config()
+ log("info", "Reloading configuration file");
+ eventmanager.fire_event("reloading-config");
+ local ok, level, err = config.load((rawget(_G, "CFG_CONFIGDIR") or ".").."/prosody.cfg.lua");
+ if not ok then
+ if level == "parser" then
+ log("error", "There was an error parsing the configuration file: %s", tostring(err));
+ elseif level == "file" then
+ log("error", "Couldn't read the config file when trying to reload: %s", tostring(err));
+ end
+ end
+end
+
+-- Function to reopen logfiles
+function prosody_reopen_logfiles()
+ log("info", "Re-opening log files");
+ eventmanager.fire_event("reopen-log-files"); -- Handled by appropriate log sinks
+end
+
+-- Function to initiate prosody shutdown
function prosody_shutdown(reason)
log("info", "Shutting down: %s", reason or "unknown reason");
eventmanager.fire_event("server-stopping", { reason = reason });