Index: trunk/FACT++/src/scheduler.cc
===================================================================
--- trunk/FACT++/src/scheduler.cc	(revision 10623)
+++ trunk/FACT++/src/scheduler.cc	(revision 10624)
@@ -58,9 +58,9 @@
 
 
-// config parameters
-// mintime
-// runtimec
-// runtimep
-// repostime
+// config parameters:
+//   mintime
+//   runtimec
+//   runtimep
+//   repostime
 
 // missing:
@@ -69,8 +69,5 @@
 // calculate sun set/rise
 //
-// check for double std sources
-//
-// return errors
-// get input from sendcommand
+// return errors and other otherput from sendcommand to webinterface
 
 // in which cases should the scheduler go in error state?
@@ -173,4 +170,5 @@
 
     int fSessionId;
+    string fDBName;
 
 
@@ -189,8 +187,4 @@
         cout << "Scheduling for the period from " << startsched << " to " << stopsched << endl;
 
-        stringstream str;
-        str << "Scheduling started -> Preview (id=" << fSessionId << ")";
-        T::Message(str);
-
         static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))");
         // 2: user
@@ -216,6 +210,12 @@
         const string passwd = what[4];
         const string server = what[5];
-        const string db     = what[9];
+        string db = what[9];
+        if (fDBName.size()!=0)
+            db = fDBName;
         const int port      = atoi(string(what[7]).c_str());
+
+        stringstream dbnamemsg;
+        dbnamemsg << "Scheduling started -> using database " << fDBName << ".";
+        T::Message(dbnamemsg);
 
         cout << "Connecting to '";
@@ -633,5 +633,5 @@
     */
 
-    AutoScheduler(ostream &out=cout) : T(out, "SCHEDULER"), fNextIsPreview(true), fSessionId(-1)
+    AutoScheduler(ostream &out=cout) : T(out, "SCHEDULER"), fNextIsPreview(true), fSessionId(-1), fDBName("")
     {
         AddStateName(kSM_Scheduling,  "Scheduling");
@@ -662,4 +662,6 @@
         {
         case kSM_Scheduling:
+            if (evt.GetSize()>0)
+                fDBName = evt.GetString();
         //case kSM_Comitting:
             //fSessionId = evt.GetInt();
@@ -674,4 +676,5 @@
     }
 };
+
 
 // ------------------------------------------------------------------------
@@ -771,9 +774,8 @@
     }
 
-    //if (conf.Has("mintime"))
-    //    cout << "has mintime --------------------+" << conf.Get<int>("mintime")<< "+------------" << endl;
-
     if (conf.Has("database"))
+    {
         database = conf.Get<string>("database").c_str();
+    }
     else
     {
@@ -781,5 +783,4 @@
         return -1;
     }
-
 
     if (conf.HasHelp() || conf.HasPrint())
Index: trunk/FACT++/src/sendcommand.cc
===================================================================
--- trunk/FACT++/src/sendcommand.cc	(revision 10623)
+++ trunk/FACT++/src/sendcommand.cc	(revision 10624)
@@ -2,21 +2,88 @@
 #include <dic.hxx>
 
+#include "Configuration.h"
+
 using namespace std;
 
-int main () {
 
-int value;
 
-value = DimClient::sendCommand("SCHEDULER/SCHEDULE", NULL, 0);
+void SetupConfiguration(Configuration &conf)
+{
+    const string n = conf.GetName()+".log";
 
-cout << "\n";
-cout << " The method sendCommand(...) will wait for the command to be actualy sent to the Server and return a completion code of : " << endl;
-cout << "                                   1 - if it was successfully sent  " << endl;
-cout << "                                   0 - if it couldn't be delivered. " << endl;
+    //po::options_description config("Program options");
+    po::options_description config("Configuration");
+    config.add_options()
+        ("dns",       var<string>("localhost"),  "Dim nameserver host name (Overwites DIM_DNS_NODE environment variable)")
+        ("log,l",     var<string>(n), "Write log-file")
+        //("no-dim,d",  po_switch(),    "Disable dim services")
+        //("console,c", var<int>(),     "Use console (0=shell, 1=simple buffered, X=simple unbuffered)")
+        ("dbname",    var<string>(),      "database name for scheduling preview")
+        ;
 
-cout << "\n";
-cout << " The completion code is now:       " << value << endl;
+    conf.AddEnv("dns", "DIM_DNS_NODE");
 
-return 0;
+    conf.AddOptions(config);
+}
+
+
+
+int main(int argc, const char* argv[])
+{
+    Configuration conf(argv[0]);
+    SetupConfiguration(conf);
+
+    po::variables_map vm;
+    try
+    {
+        vm = conf.Parse(argc, argv);
+    }
+    catch (std::exception &e)
+    {
+#if BOOST_VERSION > 104000
+        po::multiple_occurrences *MO = dynamic_cast<po::multiple_occurrences*>(&e);
+        if (MO)
+            cout << "Error: " << e.what() << " of '" << MO->get_option_name() << "' option." << endl;
+        else
+#endif
+            cout << "Error: " << e.what() << endl;
+        cout << endl;
+
+        return -1;
+    }
+
+    const char* dbname;
+    if (conf.Has("dbname"))
+        dbname = conf.Get<string>("dbname").c_str();
+    else
+    {
+        cout << "Please provide which database you want to use for scheduling using --dbname=<dbname>." << endl;
+        return -1;
+    }
+
+
+    if (conf.HasHelp() || conf.HasPrint())
+        return -1;
+
+    // To allow overwriting of DIM_DNS_NODE set 0 to 1
+    setenv("DIM_DNS_NODE", conf.Get<string>("dns").c_str(), 1);
+
+//int main ()
+//{
+
+    int value;
+
+    value = DimClient::sendCommand("SCHEDULER/SCHEDULE", dbname);
+    //value = DimClient::sendCommand("SCHEDULER/SCHEDULE", NULL, 0);
+
+    cout << "\n";
+    cout << " The method sendCommand(...) will wait for the command to be actualy sent to the Server and return a completion code of : " << endl;
+    cout << "                                   1 - if it was successfully sent  " << endl;
+    cout << "                                   0 - if it couldn't be delivered. " << endl;
+
+    cout << "\n";
+    cout << " The completion code is now:       " << value << endl;
+
+    return 0;
 
 }
