Comparison

plugins/mod_admin_shell.lua @ 11831:94cd363116a3

mod_admin_shell: Allow passing an exit code to server:shutdown() Mirroring the internal API
author Kim Alvefur <zash@zash.se>
date Thu, 30 Sep 2021 23:22:51 +0200
parent 11736:ddb87df3de30
child 11850:bfa85965106e
comparison
equal deleted inserted replaced
11830:7fe2fbfbdb1c 11831:94cd363116a3
328 return true, string.format("This server has been running for %d day%s, %d hour%s and %d minute%s (since %s)", 328 return true, string.format("This server has been running for %d day%s, %d hour%s and %d minute%s (since %s)",
329 days, (days ~= 1 and "s") or "", hours, (hours ~= 1 and "s") or "", 329 days, (days ~= 1 and "s") or "", hours, (hours ~= 1 and "s") or "",
330 minutes, (minutes ~= 1 and "s") or "", os.date("%c", prosody.start_time)); 330 minutes, (minutes ~= 1 and "s") or "", os.date("%c", prosody.start_time));
331 end 331 end
332 332
333 function def_env.server:shutdown(reason) 333 function def_env.server:shutdown(reason, code)
334 prosody.shutdown(reason); 334 prosody.shutdown(reason, code);
335 return true, "Shutdown initiated"; 335 return true, "Shutdown initiated";
336 end 336 end
337 337
338 local function human(kb) 338 local function human(kb)
339 return format_number(kb*1024, "B", "b"); 339 return format_number(kb*1024, "B", "b");