Changeset

13644:263ae995bc86

prosodyctl: reload: use admin socket to issue reload command, if available
author Matthew Wild <mwild1@gmail.com>
date Thu, 06 Feb 2025 14:24:16 +0000
parents 13643:e5f62871e6a5
children 13645:7f6f0e47624a
files prosodyctl
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/prosodyctl	Thu Feb 06 14:23:15 2025 +0000
+++ b/prosodyctl	Thu Feb 06 14:24:16 2025 +0000
@@ -502,13 +502,17 @@
 		return 0;
 	end
 
-	if arg[1] and arg[1]:match"^mod_" then
-		-- TODO reword the usage text, document
-		local shell = require "prosody.util.prosodyctl.shell";
-		arg[1] = arg[1]:match("^mod_(.*)"); -- strip mod_ prefix
-		table.insert(arg, 1, "module");
-		table.insert(arg, 2, "reload");
-		return shell.shell(arg);
+	local shell = require "prosody.util.prosodyctl.shell";
+	if shell.available() then
+		if arg[1] and arg[1]:match"^mod_" then
+			-- TODO reword the usage text, document
+			local shell = require "prosody.util.prosodyctl.shell";
+			arg[1] = arg[1]:match("^mod_(.*)"); -- strip mod_ prefix
+			table.insert(arg, 1, "module");
+			table.insert(arg, 2, "reload");
+			return shell.shell(arg);
+		end
+		return shell.shell({ "config", "reload" });
 	end
 
 	service_command_warning("reload");