aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-07-08 04:32:02 +0100
committerMatthew Wild <mwild1@gmail.com>2009-07-08 04:32:02 +0100
commit4300741747d8cee2589d236c9c89b45ca20a3834 (patch)
tree045ab7f62a03b6189d8a761a0a98d899b46bfda5 /plugins
parentb64754ac042393ea7b61318e335570f294dc6803 (diff)
downloadprosody-4300741747d8cee2589d236c9c89b45ca20a3834.tar.gz
prosody-4300741747d8cee2589d236c9c89b45ca20a3834.zip
mod_console: server:version() and server:uptime() commands
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_console.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/mod_console.lua b/plugins/mod_console.lua
index 9d47cbc6..0d6b5e41 100644
--- a/plugins/mod_console.lua
+++ b/plugins/mod_console.lua
@@ -161,6 +161,24 @@ function def_env.server:reload()
return true, "Server reloaded";
end
+function def_env.server:version()
+ return true, tostring(prosody.version or "unknown");
+end
+
+function def_env.server:uptime()
+ local t = os.time()-prosody.start_time;
+ local seconds = t%60;
+ t = (t - seconds)/60;
+ local minutes = t%60;
+ t = (t - minutes)/60;
+ local hours = t%24;
+ t = (t - hours)/24;
+ local days = t;
+ return true, string.format("This server has been running for %d day%s, %d hour%s and %d minute%s (since %s)",
+ days, (days ~= 1 and "s") or "", hours, (hours ~= 1 and "s") or "",
+ minutes, (minutes ~= 1 and "s") or "", os.date("%c", prosody.start_time));
+end
+
def_env.module = {};
local function get_hosts_set(hosts, module)