Comparison

prosodyctl @ 4335:3a2a01432b5c

Add "reload" command to prosodyctl
author Vladimir Protasov <eoranged@ya.ru>
date Thu, 04 Aug 2011 21:26:15 +0400
parent 4334:cd1b73582711
child 4336:abcbcb15205c
comparison
equal deleted inserted replaced
4334:cd1b73582711 4335:3a2a01432b5c
536 print(name..":"..string.rep(" ", longest_name-#name), module_versions[name]); 536 print(name..":"..string.rep(" ", longest_name-#name), module_versions[name]);
537 end 537 end
538 print(""); 538 print("");
539 end 539 end
540 540
541 function commands.reload(arg)
542 if arg[1] == "--help" then
543 show_usage([[reload]], [[Reload prosody configuration file]]);
544 return 1;
545 end
546
547 if not prosodyctl.isrunning() then
548 show_message("Prosody is not running");
549 return 1;
550 end
551
552 local ok, ret = prosodyctl.reload();
553 if ok then
554
555 show_message("Config updated");
556 return 0;
557 end
558
559 show_message(error_messages[ret]);
560 return 1;
561 end
541 -- ejabberdctl compatibility 562 -- ejabberdctl compatibility
542 563
543 function commands.register(arg) 564 function commands.register(arg)
544 local user, host, password = unpack(arg); 565 local user, host, password = unpack(arg);
545 if (not (user and host)) or arg[1] == "--help" then 566 if (not (user and host)) or arg[1] == "--help" then
639 print("Usage: "..arg[0].." COMMAND [OPTIONS]"); 660 print("Usage: "..arg[0].." COMMAND [OPTIONS]");
640 print(""); 661 print("");
641 print("Where COMMAND may be one of:\n"); 662 print("Where COMMAND may be one of:\n");
642 663
643 local hidden_commands = require "util.set".new{ "register", "unregister", "addplugin" }; 664 local hidden_commands = require "util.set".new{ "register", "unregister", "addplugin" };
644 local commands_order = { "adduser", "passwd", "deluser", "start", "stop", "restart", "about" }; 665 local commands_order = { "adduser", "passwd", "deluser", "start", "stop", "restart", "reload", "about" };
645 666
646 local done = {}; 667 local done = {};
647 668
648 for _, command_name in ipairs(commands_order) do 669 for _, command_name in ipairs(commands_order) do
649 local command = commands[command_name]; 670 local command = commands[command_name];