From 07243fc7d1fa26213c38130d30e26774a06ac018 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 16 Nov 2010 13:30:27 +0000 Subject: prosodyctl, util.prosodyctl: Show error when mod_posix is not enabled and an attempt is made to query Prosody's status (thanks stever) --- prosodyctl | 1 + util/prosodyctl.lua | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/prosodyctl b/prosodyctl index 74dade5f..88cf552c 100755 --- a/prosodyctl +++ b/prosodyctl @@ -160,6 +160,7 @@ local error_messages = setmetatable({ ["no-such-user"] = "The given user does not exist on the server"; ["unable-to-save-data"] = "Unable to store, perhaps you don't have permission?"; ["no-pidfile"] = "There is no 'pidfile' option in the configuration file, see http://prosody.im/doc/prosodyctl#pidfile for help"; + ["no-posix"] = "The mod_posix module is not enabled in the Prosody config file, see http://prosody.im/doc/prosodyctl for more info"; ["no-such-method"] = "This module has no commands"; ["not-running"] = "Prosody is not running"; }, { __index = function (t,k) return "Error: "..(tostring(k):gsub("%-", " "):gsub("^.", string.upper)); end }); diff --git a/util/prosodyctl.lua b/util/prosodyctl.lua index 7f3ce20e..f6cb8d7f 100644 --- a/util/prosodyctl.lua +++ b/util/prosodyctl.lua @@ -12,6 +12,7 @@ local encodings = require "util.encodings"; local stringprep = encodings.stringprep; local usermanager = require "core.usermanager"; local signal = require "util.signal"; +local set = require "util.set"; local lfs = require "lfs"; local nodeprep, nameprep = stringprep.nodeprep, stringprep.nameprep; @@ -77,6 +78,11 @@ function getpid() return false, "no-pidfile"; end + local modules_enabled = set.new(config.get("*", "core", "modules_enabled")); + if not modules_enabled:contains("posix") then + return false, "no-posix"; + end + local file, err = io.open(pidfile, "r+"); if not file then return false, "pidfile-read-failed", err; -- cgit v1.2.3