version 1.141, 2004/10/17 20:40:39
|
version 1.147, 2005/01/29 06:23:55
|
|
|
// | // |
// Modified By: Steve Hills (steve.hills@ncr.com) | // Modified By: Steve Hills (steve.hills@ncr.com) |
// | // |
|
// Modified By: Amit K Arora, IBM (amitarora@in.ibm.com) - pep 167 |
|
// |
|
// Modified By: Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#2555 |
|
// |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
| |
|
|
| |
static const char OPTION_SHUTDOWN = 's'; | static const char OPTION_SHUTDOWN = 's'; |
| |
|
static const char LONG_HELP [] = "help"; |
|
|
|
static const char LONG_VERSION [] = "version"; |
|
|
#if defined(PEGASUS_OS_HPUX) | #if defined(PEGASUS_OS_HPUX) |
static const char OPTION_BINDVERBOSE = 'X'; | static const char OPTION_BINDVERBOSE = 'X'; |
#endif | #endif |
|
|
*/ | */ |
void PrintHelp(const char* arg0) | void PrintHelp(const char* arg0) |
{ | { |
/** |
|
Build the usage string for the config command. |
|
*/ |
|
/* l10n |
|
String usage = String (USAGE); |
|
usage.append (COMMAND_NAME); |
|
usage.append (" [ [ options ] | [ configProperty=value, ... ] ]\n"); |
|
usage.append (" options\n"); |
|
usage.append (" -v - displays CIM Server version number\n"); |
|
usage.append (" -h - prints this help message\n"); |
|
usage.append (" -s - shuts down CIM Server\n"); |
|
#if !defined(PEGASUS_USE_RELEASE_DIRS) |
|
usage.append (" -D [home] - sets pegasus home directory\n"); |
|
#endif |
|
#if defined(PEGASUS_OS_TYPE_WINDOWS) |
|
usage.append (" -install [name] - installs pegasus as a Windows NT Service\n"); |
|
usage.append (" [name] is optional and overrides the\n"); |
|
usage.append (" default CIM Server Service Name\n"); |
|
usage.append (" -remove [name] - removes pegasus as a Windows NT Service\n"); |
|
usage.append (" [name] is optional and overrides the\n"); |
|
usage.append (" default CIM Server Service Name\n"); |
|
usage.append (" -start [name] - starts pegasus as a Windows NT Service\n"); |
|
usage.append (" [name] is optional and overrides the\n"); |
|
usage.append (" default CIM Server Service Name\n"); |
|
usage.append (" -stop [name] - stops pegasus as a Windows NT Service\n"); |
|
usage.append (" [name] is optional and overrides the\n"); |
|
usage.append (" default CIM Server Service Name\n\n"); |
|
#endif |
|
usage.append (" configProperty=value\n"); |
|
usage.append (" - sets CIM Server configuration property\n"); |
|
|
|
cout << endl; |
|
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) |
|
cout << PLATFORM_PRODUCT_NAME << " " << PLATFORM_PRODUCT_VERSION << endl; |
|
#else |
|
cout << PEGASUS_NAME << PEGASUS_VERSION << endl; |
|
#endif |
|
cout << endl; |
|
cout << usage << endl; |
|
*/ |
|
|
|
String usage = String (USAGE); | String usage = String (USAGE); |
usage.append (COMMAND_NAME); | usage.append (COMMAND_NAME); |
usage.append (" [ [ options ] | [ configProperty=value, ... ] ]\n"); | usage.append (" [ [ options ] | [ configProperty=value, ... ] ]\n"); |
usage.append (" options\n"); | usage.append (" options\n"); |
usage.append (" -v - displays CIM Server version number\n"); |
usage.append (" -v, --version - displays CIM Server version number\n"); |
usage.append (" -h - prints this help message\n"); |
usage.append (" -h, --help - prints this help message\n"); |
usage.append (" -s - shuts down CIM Server\n"); | usage.append (" -s - shuts down CIM Server\n"); |
#if !defined(PEGASUS_USE_RELEASE_DIRS) | #if !defined(PEGASUS_USE_RELEASE_DIRS) |
usage.append (" -D [home] - sets pegasus home directory\n"); | usage.append (" -D [home] - sets pegasus home directory\n"); |
|
|
usage.append (" - sets CIM Server configuration property\n"); | usage.append (" - sets CIM Server configuration property\n"); |
| |
cout << endl; | cout << endl; |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) |
cout << PEGASUS_PRODUCT_NAME << " " << PEGASUS_PRODUCT_VERSION << endl; |
cout << PLATFORM_PRODUCT_NAME << " " << PLATFORM_PRODUCT_VERSION << endl; |
|
#else |
|
cout << PEGASUS_NAME << PEGASUS_VERSION << endl; |
|
#endif |
|
cout << endl; | cout << endl; |
| |
#if defined(PEGASUS_OS_TYPE_WINDOWS) | #if defined(PEGASUS_OS_TYPE_WINDOWS) |
|
|
for (int i = 1; i < argc; ) | for (int i = 1; i < argc; ) |
{ | { |
const char* arg = argv[i]; | const char* arg = argv[i]; |
|
if(String::equal(arg,"--help")) |
|
{ |
|
PrintHelp(argv[0]); |
|
exit(0); |
|
} |
|
else if(String::equal(arg,"--version")) |
|
{ |
|
cout << PEGASUS_PRODUCT_VERSION << endl; |
|
exit(0); |
|
} |
// Check for -option | // Check for -option |
if (*arg == '-') |
else if (*arg == '-') |
{ | { |
// Get the option | // Get the option |
const char* option = arg + 1; | const char* option = arg + 1; |
|
|
if (*option == OPTION_VERSION && | if (*option == OPTION_VERSION && |
strlen(option) == 1) | strlen(option) == 1) |
{ | { |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) |
cout << PEGASUS_PRODUCT_VERSION << endl; |
cout << PLATFORM_PRODUCT_VERSION << endl; |
|
#else |
|
cout << PEGASUS_VERSION << endl; |
|
#endif |
|
exit(0); | exit(0); |
} | } |
// | // |
|
|
#endif | #endif |
} | } |
| |
Uint32 portNumberHttps; |
Uint32 portNumberHttps=0; |
Uint32 portNumberHttp; |
Uint32 portNumberHttp=0; |
Uint32 portNumberExportHttps; |
Uint32 portNumberExportHttps=0; |
| |
if (enableHttpsConnection) | if (enableHttpsConnection) |
{ | { |
|
|
CString portString = httpsPort.getCString(); | CString portString = httpsPort.getCString(); |
char* end = 0; | char* end = 0; |
Uint32 port = strtol(portString, &end, 10); | Uint32 port = strtol(portString, &end, 10); |
assert(end != 0 && *end == '\0'); |
if(!(end != 0 && *end == '\0')) |
|
{ |
|
PEGASUS_STD(cerr) << "Bad HTTPS Port Value" << PEGASUS_STD(endl); |
|
exit(1); |
|
} |
|
|
| |
// | // |
// Look up the WBEM-HTTPS port number | // Look up the WBEM-HTTPS port number |
|
|
CString portString = httpPort.getCString(); | CString portString = httpPort.getCString(); |
char* end = 0; | char* end = 0; |
Uint32 port = strtol(portString, &end, 10); | Uint32 port = strtol(portString, &end, 10); |
assert(end != 0 && *end == '\0'); |
if(!(end != 0 && *end == '\0')) |
|
{ |
|
PEGASUS_STD(cerr) << "Bad HTTP Port Value" << PEGASUS_STD(endl); |
|
exit(1); |
|
} |
// | // |
// Look up the WBEM-HTTP port number | // Look up the WBEM-HTTP port number |
// | // |
|
|
} | } |
#if defined(PEGASUS_DEBUG) | #if defined(PEGASUS_DEBUG) |
// Put out startup up message. | // Put out startup up message. |
cout << PEGASUS_NAME << PEGASUS_VERSION << endl; |
cout << PEGASUS_PRODUCT_NAME << " " << PEGASUS_PRODUCT_VERSION << endl; |
//l10n | //l10n |
//cout << "Built " << __DATE__ << " " << __TIME__ << endl; | //cout << "Built " << __DATE__ << " " << __TIME__ << endl; |
//cout <<"Starting..." | //cout <<"Starting..." |
|
|
| |
| |
| |
#if defined(PEGASUS_USE_23HTTPMONITOR_SERVER) |
Monitor monitor; |
Monitor monitor(true); |
|
CIMServer server(&monitor); | CIMServer server(&monitor); |
#else |
|
monitor_2 monitor; |
|
CIMServer server(&monitor); |
|
#endif |
|
| |
CimserverHolder cimserverHolder( &server ); | CimserverHolder cimserverHolder( &server ); |
| |
|
|
#endif | #endif |
| |
// Put server started message to the logger | // Put server started message to the logger |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) |
Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, |
//l10n |
Logger::INFORMATION, |
//Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
|
//"Started $0 version $1.", |
|
//PLATFORM_PRODUCT_NAME, PLATFORM_PRODUCT_VERSION); |
|
Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
|
"src.Server.cimserver.STARTED_VERSION", |
|
"Started $0 version $1.", |
|
PLATFORM_PRODUCT_NAME, PLATFORM_PRODUCT_VERSION); |
|
#else |
|
//l10n |
|
//Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
|
//"Started $0 version $1.", |
|
//PEGASUS_NAME, PEGASUS_VERSION); |
|
Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
|
"src.Server.cimserver.STARTED_VERSION", | "src.Server.cimserver.STARTED_VERSION", |
"Started $0 version $1.", | "Started $0 version $1.", |
PEGASUS_NAME, PEGASUS_VERSION); |
PEGASUS_PRODUCT_NAME, PEGASUS_PRODUCT_VERSION); |
#endif |
|
|
|
| |
// | // |
// Loop to call CIMServer's runForever() method until CIMServer | // Loop to call CIMServer's runForever() method until CIMServer |
|
|
// | // |
// normal termination | // normal termination |
// | // |
|
|
// Put server shutdown message to the logger | // Put server shutdown message to the logger |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) |
Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, |
//l10n |
Logger::INFORMATION, "src.Server.cimserver.STOPPED", |
//Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
"$0 stopped.", PEGASUS_PRODUCT_NAME); |
//"$0 stopped.", PLATFORM_PRODUCT_NAME); |
|
Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
|
"src.Server.cimserver.STOPPED", |
|
"$0 stopped.", PLATFORM_PRODUCT_NAME); |
|
#else |
|
//l10n |
|
//Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
|
//"$0 stopped.", PEGASUS_NAME); |
|
Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
|
"src.Server.cimserver.STOPPED", |
|
"$0 stopped.", PEGASUS_NAME); |
|
#endif |
|
| |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) || defined(PEGASUS_PLATFORM_SOLARIS_SPARC_CC) | #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) || defined(PEGASUS_PLATFORM_SOLARIS_SPARC_CC) |
// | // |