daemon parameter checkconfig added; ebusconfdir renamed to configpath.

This commit is contained in:
Roland Jax
2014-12-17 09:31:35 +01:00
parent 64fa3b9176
commit dc5bc4f961
2 changed files with 14 additions and 6 deletions
+4 -4
View File
@@ -100,17 +100,17 @@ BaseLoop::~BaseLoop()
result_t BaseLoop::loadMessages()
{
string confdir = A.getOptVal<const char*>("ebusconfdir");
L.log(bas, trace, "ebus configuration dir: %s", confdir.c_str());
string path = A.getOptVal<const char*>("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");
+10 -2
View File
@@ -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<bool>("checkconfig") == true) {
// TODO checkconfig(...);
}
// make me daemon
if (A.getOptVal<bool>("foreground") == true) {
L += new LogConsole(calcAreaMask(A.getOptVal<const char*>("logareas")),