mod_roster: Tidier code for the roster versioning logic
[prosody.git] / prosodyctl
index 260b3b8f5a41eabe086d8b6e77127e97af6dc11c..ccc1e2f9cfe5d86f8d3d55353d3842911aad35be 100755 (executable)
@@ -29,14 +29,6 @@ if CFG_DATADIR then
        end
 end
 
-if not require "util.dependencies".check_dependencies() then
-       os.exit(1);
-end
-
--- Required to be able to find packages installed with luarocks
-pcall(require, "luarocks.require")
-
-
 config = require "core.configmanager"
 
 do
@@ -65,6 +57,12 @@ do
        end
 end
 
+require "core.loggingmanager"
+
+if not require "util.dependencies".check_dependencies() then
+       os.exit(1);
+end
+
 prosody = { hosts = {}, events = events, platform = "posix" };
 
 local data_path = config.get("*", "core", "data_path") or CFG_DATADIR or "data";
@@ -435,6 +433,19 @@ function commands.stop(arg)
        return 1;
 end
 
+function commands.restart(arg)
+       if arg[1] == "--help" then
+               show_usage([[restart]], [[Restart a running Prosody server]]);
+               return 1;
+       end
+       
+       local ret = commands.stop(arg);
+       if ret == 0 then
+               ret = commands.start(arg);
+       end
+       return ret;
+end
+
 -- ejabberdctl compatibility
 
 function commands.register(arg)
@@ -493,6 +504,10 @@ local http_errors = {
        };
 
 function commands.addplugin(arg)
+       if not arg[1] or arg[1] == "--help" then
+               show_usage("addplugin URL", "Download and install a plugin from a URL");
+               return 1;
+       end
        local url = arg[1];
        if url:match("^http://") then
                local http = require "socket.http";
@@ -564,8 +579,8 @@ if not commands[command] then -- Show help for all commands
        print("");
        print("Where COMMAND may be one of:\n");
 
-       local hidden_commands = require "util.set".new{ "register", "unregister" };
-       local commands_order = { "adduser", "passwd", "deluser" };
+       local hidden_commands = require "util.set".new{ "register", "unregister", "addplugin" };
+       local commands_order = { "adduser", "passwd", "deluser", "start", "stop", "restart" };
 
        local done = {};