Mercurial > prosody-hg
comparison util/prosodyctl/shell.lua @ 13643:e5f62871e6a5
util.prosodyctl.shell: Export function to check for availability of admin socket
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 06 Feb 2025 14:23:15 +0000 |
| parents | ca9426f98b8e |
| children | 1465b1e305df |
comparison
equal
deleted
inserted
replaced
| 13642:1b2de94f0580 | 13643:e5f62871e6a5 |
|---|---|
| 60 | 60 |
| 61 ]]); | 61 ]]); |
| 62 print("Welcome to the Prosody administration console. For a list of commands, type: help"); | 62 print("Welcome to the Prosody administration console. For a list of commands, type: help"); |
| 63 print("You may find more help on using this console in our online documentation at "); | 63 print("You may find more help on using this console in our online documentation at "); |
| 64 print("https://prosody.im/doc/console\n"); | 64 print("https://prosody.im/doc/console\n"); |
| 65 end | |
| 66 | |
| 67 local function check() | |
| 68 local lfs = require "lfs"; | |
| 69 local socket_path = path.resolve_relative_path(prosody.paths.data, config.get("*", "admin_socket") or "prosody.sock"); | |
| 70 local state = lfs.attributes(socket_path, "mode"); | |
| 71 return state == "socket"; | |
| 65 end | 72 end |
| 66 | 73 |
| 67 local function start(arg) --luacheck: ignore 212/arg | 74 local function start(arg) --luacheck: ignore 212/arg |
| 68 local client = adminstream.client(); | 75 local client = adminstream.client(); |
| 69 local opts, err, where = parse_args(arg); | 76 local opts, err, where = parse_args(arg); |
| 178 server.loop(); | 185 server.loop(); |
| 179 end | 186 end |
| 180 | 187 |
| 181 return { | 188 return { |
| 182 shell = start; | 189 shell = start; |
| 190 available = check; | |
| 183 }; | 191 }; |
