From 05030cae048470d8556c1f027df4919fdda2faf4 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 11 Dec 2010 00:14:34 +0000 Subject: prosodyctl: Make the 'restart' command start Prosody even if it wasn't already running --- prosodyctl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 8fa12807..94816c56 100755 --- a/prosodyctl +++ b/prosodyctl @@ -509,11 +509,8 @@ function commands.restart(arg) return 1; end - local ret = commands.stop(arg); - if ret == 0 then - ret = commands.start(arg); - end - return ret; + commands.stop(arg); + return commands.start(arg); end -- ejabberdctl compatibility -- cgit v1.2.3 From c6216253af827113d16c226386602b21f521d391 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 12 Dec 2010 17:10:24 +0500 Subject: prosodyctl: Added support for --config command line argument, and multiple config parsers (to match the main prosody executable). --- prosodyctl | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 94816c56..bbd051a8 100755 --- a/prosodyctl +++ b/prosodyctl @@ -40,9 +40,30 @@ local prosody = prosody; config = require "core.configmanager" do - -- TODO: Check for other formats when we add support for them - -- Use lfs? Make a new conf/ dir? - local ok, level, err = config.load((CFG_CONFIGDIR or ".").."/prosody.cfg.lua"); + local filenames = {}; + + local filename; + if arg[1] == "--config" and arg[2] then + table.insert(filenames, arg[2]); + table.remove(arg, 1); table.remove(arg, 1); + if CFG_CONFIGDIR then + table.insert(filenames, CFG_CONFIGDIR.."/"..arg[2]); + end + else + for _, format in ipairs(config.parsers()) do + table.insert(filenames, (CFG_CONFIGDIR or ".").."/prosody.cfg."..format); + end + end + for _,_filename in ipairs(filenames) do + filename = _filename; + local file = io.open(filename); + if file then + file:close(); + CFG_CONFIGDIR = filename:match("^(.*)[\\/][^\\/]*$"); + break; + end + end + local ok, level, err = config.load(filename); if not ok then print("\n"); print("**************************"); -- cgit v1.2.3 From c5c3f9c39b37cf56f1caa2110418730ee9b24901 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 12 Dec 2010 17:17:20 +0500 Subject: prosodyctl: Read PROSODY_SRCDIR and PROSODY_PLUGINDIR environment variables, to match main prosody executable. --- prosodyctl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index bbd051a8..b2d03ed5 100755 --- a/prosodyctl +++ b/prosodyctl @@ -11,9 +11,9 @@ -- Will be modified by configure script if run -- -CFG_SOURCEDIR=nil; +CFG_SOURCEDIR=os.getenv("PROSODY_SRCDIR"); CFG_CONFIGDIR=os.getenv("PROSODY_CFGDIR"); -CFG_PLUGINDIR=nil; +CFG_PLUGINDIR=os.getenv("PROSODY_PLUGINDIR"); CFG_DATADIR=os.getenv("PROSODY_DATADIR"); -- -- -- -- -- -- -- ---- -- -- -- -- -- -- -- -- -- cgit v1.2.3 From 3f28185d4bf6fe318485cc3e392a6ab4d4d7eaf0 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 12 Dec 2010 17:18:16 +0500 Subject: prosodyctl: Added and updated some comments and some semicolons, to match main prosody executable. --- prosodyctl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index b2d03ed5..c7ef93ed 100755 --- a/prosodyctl +++ b/prosodyctl @@ -1,7 +1,7 @@ #!/usr/bin/env lua -- Prosody IM --- Copyright (C) 2008-2009 Matthew Wild --- Copyright (C) 2008-2009 Waqas Hussain +-- Copyright (C) 2008-2010 Matthew Wild +-- Copyright (C) 2008-2010 Waqas Hussain -- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. @@ -16,13 +16,15 @@ CFG_CONFIGDIR=os.getenv("PROSODY_CFGDIR"); CFG_PLUGINDIR=os.getenv("PROSODY_PLUGINDIR"); CFG_DATADIR=os.getenv("PROSODY_DATADIR"); --- -- -- -- -- -- -- ---- -- -- -- -- -- -- -- -- +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +-- Tell Lua where to find our libraries if CFG_SOURCEDIR then - package.path = CFG_SOURCEDIR.."/?.lua;"..package.path - package.cpath = CFG_SOURCEDIR.."/?.so;"..package.cpath + package.path = CFG_SOURCEDIR.."/?.lua;"..package.path; + package.cpath = CFG_SOURCEDIR.."/?.so;"..package.cpath; end +-- Substitute ~ with path to home directory in data path if CFG_DATADIR then if os.getenv("HOME") then CFG_DATADIR = CFG_DATADIR:gsub("^~", os.getenv("HOME")); -- cgit v1.2.3