diff options
author | Matthew Wild <mwild1@gmail.com> | 2025-02-06 14:23:15 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2025-02-06 14:23:15 +0000 |
commit | 137733375178e2483ee5404a374ca5aec6c65291 (patch) | |
tree | 3ab1129722ae301422593660b46860182e523c9d /util/prosodyctl | |
parent | ba53fa2e21cca6db12dc3309b78a7a2cbfed262b (diff) | |
download | prosody-137733375178e2483ee5404a374ca5aec6c65291.tar.gz prosody-137733375178e2483ee5404a374ca5aec6c65291.zip |
util.prosodyctl.shell: Export function to check for availability of admin socket
Diffstat (limited to 'util/prosodyctl')
-rw-r--r-- | util/prosodyctl/shell.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/util/prosodyctl/shell.lua b/util/prosodyctl/shell.lua index d6d885d8..a0fbb09c 100644 --- a/util/prosodyctl/shell.lua +++ b/util/prosodyctl/shell.lua @@ -64,6 +64,13 @@ local function printbanner() print("https://prosody.im/doc/console\n"); end +local function check() + local lfs = require "lfs"; + local socket_path = path.resolve_relative_path(prosody.paths.data, config.get("*", "admin_socket") or "prosody.sock"); + local state = lfs.attributes(socket_path, "mode"); + return state == "socket"; +end + local function start(arg) --luacheck: ignore 212/arg local client = adminstream.client(); local opts, err, where = parse_args(arg); @@ -180,4 +187,5 @@ end return { shell = start; + available = check; }; |