diff options
author | Kim Alvefur <zash@zash.se> | 2022-06-01 17:27:17 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2022-06-01 17:27:17 +0200 |
commit | b0c116f47b96bb5d9be4646d1031cc6606a81405 (patch) | |
tree | e9bb4fb2d23129ae8fd0effcd5d17e5f4dada4dd /plugins | |
parent | 02f67bb9171552b69088c77c3d722a53b83e8650 (diff) | |
download | prosody-b0c116f47b96bb5d9be4646d1031cc6606a81405.tar.gz prosody-b0c116f47b96bb5d9be4646d1031cc6606a81405.zip |
mod_admin_shell: Include last (mod_cron) task run time in module:info()
Don't think this is otherwise shown anywhere outside of debug logs
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_admin_shell.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua index afe91011..c498072b 100644 --- a/plugins/mod_admin_shell.lua +++ b/plugins/mod_admin_shell.lua @@ -496,6 +496,16 @@ function def_env.module:info(name, hosts) local function item_name(item) return item.name; end + local function task_timefmt(t) + if not t then + return "no last run time" + elseif os.difftime(os.time(), t) < 86400 then + return os.date("last run today at %H:%M", t); + else + return os.date("last run %A at %H:%M", t); + end + end + local friendly_descriptions = { ["adhoc-provider"] = "Ad-hoc commands", ["auth-provider"] = "Authentication provider", @@ -528,7 +538,7 @@ function def_env.module:info(name, hosts) ["metric"] = function(item) return ("%s (%s%s)%s"):format(item.name, suf(item.mf.unit, " "), item.mf.type_, pre(": ", item.mf.description)); end, - ["task"] = function (item) return string.format("%s (%s)", item.name or item.id, item.when); end + ["task"] = function (item) return string.format("%s (%s, %s)", item.name or item.id, item.when, task_timefmt(item.last)); end }; for host in hosts do |