# HG changeset patch # User Matthew Wild # Date 1738851795 0 # Node ID e5f62871e6a5170b2c633bd3abaf80ef9f09b3ca # Parent 1b2de94f05807060b2ed03ab961bd535f641ea77 util.prosodyctl.shell: Export function to check for availability of admin socket diff -r 1b2de94f0580 -r e5f62871e6a5 util/prosodyctl/shell.lua --- a/util/prosodyctl/shell.lua Thu Feb 06 12:40:11 2025 +0000 +++ b/util/prosodyctl/shell.lua Thu Feb 06 14:23:15 2025 +0000 @@ -64,6 +64,13 @@ 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 @@ return { shell = start; + available = check; };