Index: /trunk/FACT++/src/scheduler.cc
===================================================================
--- /trunk/FACT++/src/scheduler.cc	(revision 10700)
+++ /trunk/FACT++/src/scheduler.cc	(revision 10701)
@@ -1,2 +1,4 @@
+#include <vector>
+
 #include <boost/bind.hpp>
 #if BOOST_VERSION < 104400
@@ -8,5 +10,10 @@
 #include <boost/regex.hpp>
 #include <boost/asio/deadline_timer.hpp>
-
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+#include <mysql++/mysql++.h>
+
+#include "FACT.h"
+#include "Dim.h"
 #include "Time.h"
 #include "Event.h"
@@ -18,13 +25,7 @@
 #include "Console.h"
 #include "Converter.h"
+#include "LocalControl.h"
 
 #include "tools.h"
-
-#include <vector>
-
-#include "LocalControl.h"
-#include <boost/date_time/posix_time/posix_time.hpp>
-#include <mysql++/mysql++.h>
-
 
 namespace ba    = boost::asio;
@@ -750,7 +751,29 @@
 }
 
+void PrintUsage()
+{
+    cout <<
+        "The scheduler... TEXT MISSING\n"
+        "\n"
+        "The default is that the program is started without user intercation. "
+        "All actions are supposed to arrive as DimCommands. Using the -c "
+        "option, a local shell can be initialized. With h or help a short "
+        "help message about the usuage can be brought to the screen.\n"
+        "\n"
+        "Usage: scheduler [-c type] [OPTIONS]\n"
+        "  or:  scheduler [OPTIONS]\n";
+    cout << endl;
+}
+
+void PrintHelp()
+{
+    /* Additional help text which is printed after the configuration
+     options goes here */
+}
+
 int main(int argc, const char* argv[])
 {
     Configuration conf(argv[0]);
+    conf.SetPrintUsage(PrintUsage);
     SetupConfiguration(conf);
 
@@ -774,9 +797,20 @@
     }
 
-    if (conf.Has("database"))
-    {
-        database = conf.Get<string>("database").c_str();
-    }
-    else
+    if (conf.HasPrint())
+        return -1;
+
+    if (conf.HasVersion())
+    {
+        FACT::PrintVersion(argv[0]);
+        return -1;
+    }
+
+    if (conf.HasHelp())
+    {
+        PrintHelp();
+        return -1;
+    }
+
+    if (!conf.Has("database"))
     {
         cout << "Please provide which database you want to use for scheduling." << endl;
@@ -784,11 +818,9 @@
     }
 
-    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);
-
-    try
+    database = conf.Get<string>("database").c_str();
+
+    Dim::Setup(conf.Get<string>("dns"));
+
+//    try
     {
         // No console access at all
@@ -816,8 +848,8 @@
         }
     }
-    catch (std::exception& e)
+/*    catch (std::exception& e)
     {
         std::cerr << "Exception: " << e.what() << "\n";
-    }
+    }*/
 
     return 0;
