Changeset 10709 for trunk/FACT++/src/scheduler.cc
- Timestamp:
- 05/13/11 16:48:46 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/scheduler.cc
r10701 r10709 38 38 using namespace boost::gregorian; 39 39 using namespace boost::posix_time; 40 41 42 // string containing database information43 string database;44 40 45 41 // things to be done/checked/changed … … 171 167 172 168 int fSessionId; 169 string fDatabase; 173 170 string fDBName; 174 171 … … 196 193 197 194 boost::smatch what; 198 if (!boost::regex_match( database, what, expr, boost::match_extra))199 { 200 cout << "Couldn't parse '" << database << "'." << endl;195 if (!boost::regex_match(fDatabase, what, expr, boost::match_extra)) 196 { 197 cout << "Couldn't parse '" << fDatabase << "'." << endl; 201 198 throw; 202 199 } … … 204 201 if (what.size()!=10) 205 202 { 206 cout << "Error parsing '" << database << "'." << endl;203 cout << "Error parsing '" << fDatabase << "'." << endl; 207 204 throw; 208 205 } … … 676 673 return T::GetCurrentState(); 677 674 } 675 676 bool SetConfiguration(const Configuration &conf) 677 { 678 fDatabase = conf.Get<string>("schedule-database"); 679 680 return true; 681 } 682 678 683 }; 679 684 … … 694 699 // Start io_service.run to only use the commandHandler command detaching 695 700 AutoScheduler<S> io_service(wout); 701 if (!io_service.SetConfiguration(conf)) 702 return -1; 703 696 704 io_service.Run(); 697 705 … … 712 720 713 721 AutoScheduler<S> io_service(wout); 722 if (!io_service.SetConfiguration(conf)) 723 return -1; 724 714 725 shell.SetReceiver(io_service); 715 726 … … 738 749 po::options_description config("Configuration"); 739 750 config.add_options() 740 ("dns", var<string>("localhost"), "Dim nameserver host name (Overwites DIM_DNS_NODE environment variable)") 741 ("log,l", var<string>(n), "Write log-file") 742 ("no-dim,d", po_switch(), "Disable dim services") 743 ("console,c", var<int>(), "Use console (0=shell, 1=simple buffered, X=simple unbuffered)") 744 ("mintime", var<int>(), "minimum observation time") 751 ("dns", var<string>("localhost"), "Dim nameserver host name (Overwites DIM_DNS_NODE environment variable)") 752 ("log,l", var<string>(n), "Write log-file") 753 ("no-dim,d", po_switch(), "Disable dim services") 754 ("console,c", var<int>(), "Use console (0=shell, 1=simple buffered, X=simple unbuffered)") 755 ("schedule-database", var<string>()->required(), 756 "Database link as in\n\t[user:[password]@][server][:port][/database]\nOverwrites options from the default configuration file.") 757 ("mintime", var<int>(), "minimum observation time") 745 758 ; 746 759 760 po::positional_options_description p; 761 p.add("schedule-database", 1); // The first positional options 762 747 763 conf.AddEnv("dns", "DIM_DNS_NODE"); 748 749 764 conf.AddOptions(config); 750 conf. AddOptionsDatabase(config);765 conf.SetArgumentPositions(p); 751 766 } 752 767 … … 761 776 "help message about the usuage can be brought to the screen.\n" 762 777 "\n" 763 "Usage: scheduler [-c type] [OPTIONS] \n"764 " or: scheduler [OPTIONS] \n";778 "Usage: scheduler [-c type] [OPTIONS] <schedule-database>\n" 779 " or: scheduler [OPTIONS] <schedule-database>\n"; 765 780 cout << endl; 766 781 } … … 812 827 } 813 828 814 if (!conf.Has("database"))815 {816 cout << "Please provide which database you want to use for scheduling." << endl;817 return -1;818 }819 820 database = conf.Get<string>("database").c_str();821 822 829 Dim::Setup(conf.Get<string>("dns")); 823 830
Note:
See TracChangeset
for help on using the changeset viewer.