Commit | Line | Data |
---|---|---|
b1be615b BS |
1 | /** @file |
2 | * @brief The main function. | |
3 | * | |
4 | * | |
5 | * | |
6 | * @copyright Intra2net AG | |
7 | * @license GPLv2 | |
8 | */ | |
4545a371 BS |
9 | |
10 | #ifdef HAVE_CONFIG_H | |
11 | #include <config.h> | |
12 | #endif | |
13 | ||
14 | #define VERSION 0 | |
15 | #define REVISION 1 | |
16 | #define RELEASE 0 | |
17 | ||
18 | #include <iostream> | |
19 | #include <list> | |
20 | #include <string> | |
21 | ||
22 | #include <boost/foreach.hpp> | |
23 | ||
24 | #include "updater.cpp" | |
25 | #include "config.cpp" | |
254bbf53 | 26 | #include "logger.cpp" |
4545a371 BS |
27 | |
28 | #include "service.cpp" | |
29 | ||
30 | #include "dhs.cpp" | |
31 | #include "ods.cpp" | |
32 | ||
33 | using namespace std; | |
34 | ||
85a0abf9 BS |
35 | typedef boost::shared_ptr<Updater> UpdaterPtr; |
36 | ||
4545a371 | 37 | /** |
b1be615b BS |
38 | * @brief The main part. |
39 | * @param argc Number of arguments | |
40 | * @param argv Command line arguments | |
41 | * @return 0 if all is fine. | |
4545a371 BS |
42 | */ |
43 | int main(int argc, char *argv[]) | |
44 | { | |
38060291 | 45 | // initialize Updater |
254bbf53 | 46 | UpdaterPtr updater(new Updater); |
38060291 | 47 | |
254bbf53 | 48 | // load the cmd options |
38060291 | 49 | if ( updater->init_config_from_cmd(argc,argv) != 0 ) |
1cf4e2b5 | 50 | return 0; |
38060291 | 51 | |
254bbf53 | 52 | // load the config and service files |
38060291 | 53 | if ( updater->init_config_from_files() != 0 ) |
98bd3874 | 54 | return 0; |
4545a371 | 55 | |
3434b35f BS |
56 | cout << "Loglevel: " << updater->get_config()->get_loglevel() << endl; |
57 | ||
254bbf53 BS |
58 | // set the configured loggin facility, default stdout |
59 | ||
60 | // initialize daemon mode if configured | |
61 | ||
62 | // update all configured services | |
4545a371 BS |
63 | updater->update_services(); |
64 | ||
4545a371 BS |
65 | return 0; |
66 | } |