aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-01-23 21:43:36 +0000
committerMatthew Wild <mwild1@gmail.com>2020-01-23 21:43:36 +0000
commiteb65fad92ba437f1a3c2b0cd9d2bb0b62aae82e5 (patch)
tree0612f6d99e44e64a67d821f3ad3406279facc743
parenta8394d1773a8fbc96cd2cb248712e69b1d27d809 (diff)
downloadprosody-eb65fad92ba437f1a3c2b0cd9d2bb0b62aae82e5.tar.gz
prosody-eb65fad92ba437f1a3c2b0cd9d2bb0b62aae82e5.zip
Log warning when using prosodyctl start/stop/restart
-rwxr-xr-xprosodyctl20
1 files changed, 20 insertions, 0 deletions
diff --git a/prosodyctl b/prosodyctl
index 982b102e..b16d9230 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -198,11 +198,25 @@ function commands.deluser(arg)
return 1;
end
+local function service_command_warning(command)
+ if prosody.installed and configmanager.get("*", "prosodyctl_service_warnings") ~= false then
+ show_warning("WARNING: Use of prosodyctl start/stop/restart/reload is not recommended");
+ show_warning(" if Prosody is managed by an init system - use that directly instead.");
+ if lfs.attributes("/etc/systemd") then
+ show_warning(" e.g. systemctl %s prosody", command);
+ elseif lfs.attributes("/etc/init.d/prosody") then
+ show_warning(" e.g. /etc/init.d/prosody %s", command);
+ end
+ show_warning("");
+ end
+end
+
function commands.start(arg)
if arg[1] == "--help" then
show_usage([[start]], [[Start Prosody]]);
return 1;
end
+ service_command_warning("start");
local ok, ret = prosodyctl.isrunning();
if not ok then
show_message(error_messages[ret]);
@@ -293,6 +307,8 @@ function commands.stop(arg)
return 1;
end
+ service_command_warning("stop");
+
if not prosodyctl.isrunning() then
show_message("Prosody is not running");
return 1;
@@ -328,6 +344,8 @@ function commands.restart(arg)
return 1;
end
+ service_command_warning("restart");
+
commands.stop(arg);
return commands.start(arg);
end
@@ -421,6 +439,8 @@ function commands.reload(arg)
return 1;
end
+ service_command_warning("reload");
+
if not prosodyctl.isrunning() then
show_message("Prosody is not running");
return 1;