From dc5bc4f96108008e558926e041504b84e7cf206a Mon Sep 17 00:00:00 2001 From: Roland Jax Date: Wed, 17 Dec 2014 09:31:35 +0100 Subject: [PATCH] daemon parameter checkconfig added; ebusconfdir renamed to configpath. --- src/ebusd/baseloop.cpp | 8 ++++---- src/ebusd/ebusd.cpp | 12 ++++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/ebusd/baseloop.cpp b/src/ebusd/baseloop.cpp index e2f2b786..3e592caa 100644 --- a/src/ebusd/baseloop.cpp +++ b/src/ebusd/baseloop.cpp @@ -100,17 +100,17 @@ BaseLoop::~BaseLoop() result_t BaseLoop::loadMessages() { - string confdir = A.getOptVal("ebusconfdir"); - L.log(bas, trace, "ebus configuration dir: %s", confdir.c_str()); + string path = A.getOptVal("configpath"); + L.log(bas, trace, "path to ebus configuration files: %s", path.c_str()); m_messages->clear(); m_templates->clear(); - result_t result = m_templates->readFromFile(confdir+"/_types.csv"); + result_t result = m_templates->readFromFile(path+"/_types.csv"); if (result == RESULT_OK) L.log(bas, trace, "read templates"); else L.log(bas, error, "error reading templates: %s", getResultCode(result)); - result = readConfigFiles(confdir, ".csv"); + result = readConfigFiles(path, ".csv"); if (result == RESULT_OK) { L.log(bas, trace, "read config files"); diff --git a/src/ebusd/ebusd.cpp b/src/ebusd/ebusd.cpp index 7c1a92f3..a6014e84 100644 --- a/src/ebusd/ebusd.cpp +++ b/src/ebusd/ebusd.cpp @@ -73,8 +73,11 @@ void define_args() A.addOption("pollinterval", "", OptVal(5), dt_int, ot_mandatory, "polling interval in 's' (5)\n"); - A.addOption("ebusconfdir", "e", OptVal("/etc/ebusd"), dt_string, ot_mandatory, - "directory for ebus configuration (/etc/ebusd)\n"); + A.addOption("configpath", "c", OptVal("/etc/ebusd"), dt_string, ot_mandatory, + "path to ebus configuration files (/etc/ebusd)"); + + A.addOption("checkconfig", "", OptVal(false), dt_bool, ot_none, + "check of configuration files (enable foreground)\n"); A.addOption("foreground", "f", OptVal(false), dt_bool, ot_none, "run in foreground\n"); @@ -157,6 +160,11 @@ int main(int argc, char* argv[]) // parse arguments A.parseArgs(argc, argv); + // check of configuration files + if (A.getOptVal("checkconfig") == true) { + // TODO checkconfig(...); + } + // make me daemon if (A.getOptVal("foreground") == true) { L += new LogConsole(calcAreaMask(A.getOptVal("logareas")),