Changeset

10609:f35cbfe546d1

Merge 0.11->trunk
author Matthew Wild <mwild1@gmail.com>
date Thu, 23 Jan 2020 21:44:42 +0000
parents 10604:3b0d9919f361 (current diff) 10608:87003b937672 (diff)
children 10611:c10511380c0f
files prosodyctl
diffstat 2 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Sun Jan 19 16:01:29 2020 +0000
+++ b/.hgtags	Thu Jan 23 21:44:42 2020 +0000
@@ -70,3 +70,5 @@
 bb8486491b48431236c0d32548c20d9853781e69 0.10.3
 4f8b6c09e5f328e3d3d4233dc78fa4fd0535171c 0.11.2
 dd7e924c74ef27b7f92eb872d2db50aaa229b234 0.11.3
+10d6d0d91f4ec47a6eb446792fee1d4b79a914d7 0.11.4
+dbd60f47316492bc367802914dc8fa47f4b3edac 0.11.5
--- a/prosodyctl	Sun Jan 19 16:01:29 2020 +0000
+++ b/prosodyctl	Thu Jan 23 21:44:42 2020 +0000
@@ -222,11 +222,25 @@
 	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]);
@@ -325,6 +339,8 @@
 		return 1;
 	end
 
+	service_command_warning("stop");
+
 	if not prosodyctl.isrunning() then
 		show_message("Prosody is not running");
 		return 1;
@@ -360,6 +376,8 @@
 		return 1;
 	end
 
+	service_command_warning("restart");
+
 	commands.stop(arg);
 	return commands.start(arg);
 end
@@ -460,6 +478,8 @@
 		return 1;
 	end
 
+	service_command_warning("reload");
+
 	if not prosodyctl.isrunning() then
 		show_message("Prosody is not running");
 		return 1;