Software /
code /
prosody
Comparison
prosodyctl @ 10061:5c71693c8345
Merge 0.11->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 08 Jul 2019 02:44:32 +0200 |
parent | 9992:9d6baacdd8e6 |
child | 10064:1acfd25cd507 |
child | 10122:95814c597836 |
comparison
equal
deleted
inserted
replaced
10060:7a36b7ac309b | 10061:5c71693c8345 |
---|---|
81 local jid_split = require "util.jid".prepped_split; | 81 local jid_split = require "util.jid".prepped_split; |
82 | 82 |
83 local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2; | 83 local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2; |
84 ----------------------- | 84 ----------------------- |
85 local commands = {}; | 85 local commands = {}; |
86 local command = arg[1]; | 86 local command = table.remove(arg, 1); |
87 | 87 |
88 function commands.adduser(arg) | 88 function commands.adduser(arg) |
89 if not arg[1] or arg[1] == "--help" then | 89 if not arg[1] or arg[1] == "--help" then |
90 show_usage([[adduser JID]], [[Create the specified user account in Prosody]]); | 90 show_usage([[adduser JID]], [[Create the specified user account in Prosody]]); |
91 return 1; | 91 return 1; |
220 show_message("Prosody is already running with PID %s", ret or "(unknown)"); | 220 show_message("Prosody is already running with PID %s", ret or "(unknown)"); |
221 return 1; | 221 return 1; |
222 end | 222 end |
223 | 223 |
224 --luacheck: ignore 411/ret | 224 --luacheck: ignore 411/ret |
225 local ok, ret = prosodyctl.start(prosody.paths.source); | 225 local ok, ret = prosodyctl.start(prosody.paths.source, arg[-1]); |
226 if ok then | 226 if ok then |
227 local daemonize = configmanager.get("*", "daemonize"); | 227 local daemonize = configmanager.get("*", "daemonize"); |
228 if daemonize == nil then | 228 if daemonize == nil then |
229 daemonize = prosody.installed; | 229 daemonize = prosody.installed; |
230 end | 230 end |
361 hgrepo = hgrepo == "010452cfaf53" and "prosody-modules"; | 361 hgrepo = hgrepo == "010452cfaf53" and "prosody-modules"; |
362 return path..(hgid and " - "..(hgrepo or "HG").." rev: "..hgid or "") | 362 return path..(hgid and " - "..(hgrepo or "HG").." rev: "..hgid or "") |
363 .."\n "; | 363 .."\n "; |
364 end))); | 364 end))); |
365 print(""); | 365 print(""); |
366 local have_pposix, pposix = pcall(require, "util.pposix"); | |
367 if have_pposix and pposix.uname then | |
368 print("# Operating system"); | |
369 local uname, err = pposix.uname(); | |
370 print(uname and uname.sysname .. " " .. uname.release or "Unknown POSIX", err or ""); | |
371 print(""); | |
372 end | |
366 print("# Lua environment"); | 373 print("# Lua environment"); |
367 print("Lua version: ", _G._VERSION); | 374 print("Lua version: ", _G._VERSION); |
368 print(""); | 375 print(""); |
369 print("Lua module search paths:"); | 376 print("Lua module search paths:"); |
370 for path in package.path:gmatch("[^;]+") do | 377 for path in package.path:gmatch("[^;]+") do |
809 end | 816 end |
810 if not what or what == "config" then | 817 if not what or what == "config" then |
811 print("Checking config..."); | 818 print("Checking config..."); |
812 local deprecated = set.new({ | 819 local deprecated = set.new({ |
813 "bosh_ports", "disallow_s2s", "no_daemonize", "anonymous_login", "require_encryption", | 820 "bosh_ports", "disallow_s2s", "no_daemonize", "anonymous_login", "require_encryption", |
814 "vcard_compatibility", | 821 "vcard_compatibility", "cross_domain_bosh", "cross_domain_websocket" |
815 }); | 822 }); |
816 local known_global_options = set.new({ | 823 local known_global_options = set.new({ |
817 "pidfile", "log", "plugin_paths", "prosody_user", "prosody_group", "daemonize", | 824 "pidfile", "log", "plugin_paths", "prosody_user", "prosody_group", "daemonize", |
818 "umask", "prosodyctl_timeout", "use_ipv6", "use_libevent", "network_settings", | 825 "umask", "prosodyctl_timeout", "use_ipv6", "use_libevent", "network_settings", |
819 "network_backend", "http_default_host", | 826 "network_backend", "http_default_host", |
1303 show_message("Failed to load module '"..module_name.."': "..err); | 1310 show_message("Failed to load module '"..module_name.."': "..err); |
1304 os.exit(1); | 1311 os.exit(1); |
1305 end | 1312 end |
1306 end | 1313 end |
1307 | 1314 |
1308 table.remove(arg, 1); | |
1309 | |
1310 local module = modulemanager.get_module("*", module_name); | 1315 local module = modulemanager.get_module("*", module_name); |
1311 if not module then | 1316 if not module then |
1312 show_message("Failed to load module '"..module_name.."': Unknown error"); | 1317 show_message("Failed to load module '"..module_name.."': Unknown error"); |
1313 os.exit(1); | 1318 os.exit(1); |
1314 end | 1319 end |
1368 | 1373 |
1369 | 1374 |
1370 os.exit(0); | 1375 os.exit(0); |
1371 end | 1376 end |
1372 | 1377 |
1373 os.exit(commands[command]({ select(2, unpack(arg)) })); | 1378 os.exit(commands[command](arg)); |
1374 end, watchers); | 1379 end, watchers); |
1375 | 1380 |
1376 command_runner:run(true); | 1381 command_runner:run(true); |