version 1.201, 2007/06/05 12:38:20
|
version 1.202, 2007/06/19 17:58:04
|
|
|
usage.append (" -D [home] - sets pegasus home directory\n"); | usage.append (" -D [home] - sets pegasus home directory\n"); |
#endif | #endif |
#if defined(PEGASUS_OS_TYPE_WINDOWS) | #if defined(PEGASUS_OS_TYPE_WINDOWS) |
usage.append (" -install [name] - installs pegasus as a Windows Service\n"); |
usage.append(" -install [name] - installs pegasus as a Windows " |
usage.append (" [name] is optional and overrides the\n"); |
"Service\n"); |
|
usage.append(" [name] is optional and overrides " |
|
"the\n"); |
usage.append (" default CIM Server Service Name\n"); | usage.append (" default CIM Server Service Name\n"); |
usage.append (" by appending [name]\n"); | usage.append (" by appending [name]\n"); |
usage.append (" -remove [name] - removes pegasus as a Windows Service\n"); |
usage.append(" -remove [name] - removes pegasus as a Windows " |
usage.append (" [name] is optional and overrides the\n"); |
"Service\n"); |
|
usage.append(" [name] is optional and overrides " |
|
"the\n"); |
usage.append (" default CIM Server Service Name\n"); | usage.append (" default CIM Server Service Name\n"); |
usage.append (" by appending [name]\n"); | usage.append (" by appending [name]\n"); |
usage.append (" -start [name] - starts pegasus as a Windows Service\n"); | usage.append (" -start [name] - starts pegasus as a Windows Service\n"); |
usage.append (" [name] is optional and overrides the\n"); |
usage.append(" [name] is optional and overrides " |
|
"the\n"); |
usage.append (" default CIM Server Service Name\n"); | usage.append (" default CIM Server Service Name\n"); |
usage.append (" by appending [name]\n"); | usage.append (" by appending [name]\n"); |
usage.append (" -stop [name] - stops pegasus as a Windows Service\n"); | usage.append (" -stop [name] - stops pegasus as a Windows Service\n"); |
usage.append (" [name] is optional and overrides the\n"); |
usage.append(" [name] is optional and overrides " |
|
"the\n"); |
usage.append (" default CIM Server Service Name\n"); | usage.append (" default CIM Server Service Name\n"); |
usage.append (" by appending [name]\n\n"); | usage.append (" by appending [name]\n\n"); |
#endif | #endif |
usage.append (" configProperty=value\n"); | usage.append (" configProperty=value\n"); |
usage.append (" - sets CIM Server configuration property\n"); |
usage.append(" - sets CIM Server configuration " |
|
"property\n"); |
| |
cout << endl; | cout << endl; |
cout << _cimServerProcess->getProductName() << " " << _cimServerProcess->getCompleteVersion() << endl; |
cout << _cimServerProcess->getProductName() << " " << |
|
_cimServerProcess->getCompleteVersion() << endl; |
cout << endl; | cout << endl; |
| |
#if defined(PEGASUS_OS_TYPE_WINDOWS) | #if defined(PEGASUS_OS_TYPE_WINDOWS) |
MessageLoaderParms parms("src.Server.cimserver.MENU.WINDOWS", usage); | MessageLoaderParms parms("src.Server.cimserver.MENU.WINDOWS", usage); |
#elif defined(PEGASUS_USE_RELEASE_DIRS) | #elif defined(PEGASUS_USE_RELEASE_DIRS) |
MessageLoaderParms parms("src.Server.cimserver.MENU.HPUXLINUXIA64GNU", usage); |
MessageLoaderParms parms( |
|
"src.Server.cimserver.MENU.HPUXLINUXIA64GNU", |
|
usage); |
#else | #else |
MessageLoaderParms parms("src.Server.cimserver.MENU.STANDARD", usage); | MessageLoaderParms parms("src.Server.cimserver.MENU.STANDARD", usage); |
#endif | #endif |
cout << MessageLoader::getMessage(parms) << endl; | cout << MessageLoader::getMessage(parms) << endl; |
} | } |
| |
//This needs to be called at various points in the code depending on the platform and error conditions. |
// This needs to be called at various points in the code depending on the |
//We need to delete the _cimServer reference on exit in order for the destructors to get called. |
// platform and error conditions. |
|
// We need to delete the _cimServer reference on exit in order for the |
|
// destructors to get called. |
void deleteCIMServer() | void deleteCIMServer() |
{ | { |
if (_cimServer) | if (_cimServer) |
|
|
delete _cimServer; | delete _cimServer; |
_cimServer = 0; | _cimServer = 0; |
| |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) \ |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) || \ |
|| defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) \ |
defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) || \ |
|| defined(PEGASUS_OS_SOLARIS) || defined(PEGASUS_OS_VMS) |
defined(PEGASUS_OS_SOLARIS) || defined(PEGASUS_OS_VMS) |
// | // |
// Remove the PID file to indicate CIMServer termination | // Remove the PID file to indicate CIMServer termination |
// | // |
FileSystem::removeFile(_cimServerProcess->getPIDFileName()); | FileSystem::removeFile(_cimServerProcess->getPIDFileName()); |
#endif | #endif |
} | } |
|
|
delete _monitor; | delete _monitor; |
|
|
if (dummyInitialThread) | if (dummyInitialThread) |
{ | { |
Thread::clearLanguages(); | Thread::clearLanguages(); |
|
|
} | } |
} | } |
| |
// l10n |
|
// | // |
// Dummy function for the Thread object associated with the initial thread. | // Dummy function for the Thread object associated with the initial thread. |
// Since the initial thread is used to process CIM requests, this is | // Since the initial thread is used to process CIM requests, this is |
|
|
// | // |
ThreadReturnType PEGASUS_THREAD_CDECL dummyThreadFunc(void *parm) | ThreadReturnType PEGASUS_THREAD_CDECL dummyThreadFunc(void *parm) |
{ | { |
return((ThreadReturnType)0); |
return (ThreadReturnType)0; |
} | } |
| |
#ifdef PEGASUS_ENABLE_PRIVILEGE_SEPARATION | #ifdef PEGASUS_ENABLE_PRIVILEGE_SEPARATION |
|
|
Boolean shutdownOption = false; | Boolean shutdownOption = false; |
Boolean debugOutputOption = false; | Boolean debugOutputOption = false; |
| |
//l10n |
|
// Set Message loading to process locale | // Set Message loading to process locale |
MessageLoader::_useProcessLocale = true; | MessageLoader::_useProcessLocale = true; |
//l10n |
|
| |
//l10n |
|
#if defined(PEGASUS_OS_AIX) && defined(PEGASUS_HAS_MESSAGES) | #if defined(PEGASUS_OS_AIX) && defined(PEGASUS_HAS_MESSAGES) |
setlocale(LC_ALL, ""); | setlocale(LC_ALL, ""); |
#endif | #endif |
|
|
// | // |
#if defined(PEGASUS_OS_AIX) && defined(PEGASUS_USE_RELEASE_DIRS) | #if defined(PEGASUS_OS_AIX) && defined(PEGASUS_USE_RELEASE_DIRS) |
pegasusHome = AIX_RELEASE_PEGASUS_HOME; | pegasusHome = AIX_RELEASE_PEGASUS_HOME; |
#elif !defined(PEGASUS_USE_RELEASE_DIRS) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) |
# elif !defined(PEGASUS_USE_RELEASE_DIRS) || \ |
|
defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) |
const char* tmp = getenv("PEGASUS_HOME"); | const char* tmp = getenv("PEGASUS_HOME"); |
| |
if (tmp) | if (tmp) |
|
|
} | } |
else | else |
{ | { |
//l10n |
|
//cout << "Missing argument for option -" << option << endl; |
|
String opt(option); | String opt(option); |
MessageLoaderParms parms("src.Server.cimserver.MISSING_ARGUMENT", |
MessageLoaderParms parms( |
|
"src.Server.cimserver.MISSING_ARGUMENT", |
"Missing argument for option -$0", | "Missing argument for option -$0", |
opt); | opt); |
cout << MessageLoader::getMessage(parms) << endl; | cout << MessageLoader::getMessage(parms) << endl; |
|
|
// | // |
if (shutdownOption) | if (shutdownOption) |
{ | { |
//l10n |
MessageLoaderParms parms( |
//cout << "Duplicate shutdown option specified." << endl; |
"src.Server.cimserver.DUPLICATE_SHUTDOWN_OPTION", |
MessageLoaderParms parms("src.Server.cimserver.DUPLICATE_SHUTDOWN_OPTION", |
|
"Duplicate shutdown option specified."); | "Duplicate shutdown option specified."); |
| |
cout << MessageLoader::getMessage(parms) << endl; | cout << MessageLoader::getMessage(parms) << endl; |
|
|
// | // |
try | try |
{ | { |
// If current process is "cimserver -s" (shutdown option = true) the contents |
// If current process is "cimserver -s" (shutdown option = true) the |
// of current config should not be overwriten by planned config |
// contents of current config should not be overwritten by planned |
|
// config |
GetOptions(configManager, argc, argv, shutdownOption); | GetOptions(configManager, argc, argv, shutdownOption); |
} | } |
catch (Exception& e) | catch (Exception& e) |
|
|
return(1); | return(1); |
} | } |
| |
// l10n |
|
// Set the home directory, msg sub-dir, into the MessageLoader. | // Set the home directory, msg sub-dir, into the MessageLoader. |
// This will be the default directory where the resource bundles | // This will be the default directory where the resource bundles |
// are found. | // are found. |
|
|
#ifdef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET | #ifdef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET |
if (!enableHttpConnection && !enableHttpsConnection) | if (!enableHttpConnection && !enableHttpsConnection) |
{ | { |
//l10n |
|
//Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, |
|
//"Neither HTTP nor HTTPS connection is enabled. " |
|
//"CIMServer will not be started."); |
|
Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, | Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, |
"src.Server.cimserver.HTTP_NOT_ENABLED_SERVER_NOT_STARTING", | "src.Server.cimserver.HTTP_NOT_ENABLED_SERVER_NOT_STARTING", |
"Neither HTTP nor HTTPS connection is enabled. CIMServer will not be started."); |
"Neither HTTP nor HTTPS connection is enabled. CIMServer will " |
//cerr << "Neither HTTP nor HTTPS connection is enabled. " |
"not be started."); |
//"CIMServer will not be started." << endl; |
MessageLoaderParms parms( |
MessageLoaderParms parms("src.Server.cimserver.HTTP_NOT_ENABLED_SERVER_NOT_STARTING", |
"src.Server.cimserver.HTTP_NOT_ENABLED_SERVER_NOT_STARTING", |
"Neither HTTP nor HTTPS connection is enabled. CIMServer will not be started."); |
"Neither HTTP nor HTTPS connection is enabled. CIMServer will " |
|
"not be started."); |
cerr << MessageLoader::getMessage(parms) << endl; | cerr << MessageLoader::getMessage(parms) << endl; |
return(1); | return(1); |
} | } |
|
|
{ | { |
String configTimeout = | String configTimeout = |
configManager->getCurrentValue("shutdownTimeout"); | configManager->getCurrentValue("shutdownTimeout"); |
Uint32 timeoutValue = strtol(configTimeout.getCString(), (char **)0, 10); |
Uint32 timeoutValue = |
// To deregister Pegasus with SLP |
strtol(configTimeout.getCString(), (char **)0, 10); |
#ifdef PEGASUS_SLP_REG_TIMEOUT | #ifdef PEGASUS_SLP_REG_TIMEOUT |
|
// To deregister Pegasus with SLP |
unregisterPegasusFromSLP(); | unregisterPegasusFromSLP(); |
#endif | #endif |
| |
|
|
"CIM Server stopped."); | "CIM Server stopped."); |
| |
cout << MessageLoader::getMessage(parms) << endl; | cout << MessageLoader::getMessage(parms) << endl; |
return(0); |
return 0; |
} | } |
| |
#if defined(PEGASUS_DEBUG) && !defined(PEGASUS_USE_SYSLOGS) | #if defined(PEGASUS_DEBUG) && !defined(PEGASUS_USE_SYSLOGS) |
|
|
startupEnableMSC(); | startupEnableMSC(); |
#endif | #endif |
| |
// Bug 2148 - Here is the order of operations for determining the server HTTP and HTTPS ports. |
// Bug 2148 - Here is the order of operations for determining the server |
|
// HTTP and HTTPS ports. |
// 1) If the user explicitly specified a port, use it. | // 1) If the user explicitly specified a port, use it. |
// 2) If the user did not specify a port, get the port from the services file. |
// 2) If the user did not specify a port, get the port from the services |
// 3) If no value is specified in the services file, use the IANA WBEM default port. |
// file. |
|
// 3) If no value is specified in the services file, use the IANA WBEM |
|
// default port. |
// Note that 2 and 3 are done within the System::lookupPort method | // Note that 2 and 3 are done within the System::lookupPort method |
// An empty string from the ConfigManager implies that the user did not specify a port. |
// An empty string from the ConfigManager implies that the user did not |
|
// specify a port. |
| |
Uint32 portNumberHttps=0; | Uint32 portNumberHttps=0; |
Uint32 portNumberHttp=0; | Uint32 portNumberHttp=0; |
|
|
// | // |
// Look up the WBEM-HTTPS port number | // Look up the WBEM-HTTPS port number |
// | // |
portNumberHttps = System::lookupPort(WBEM_HTTPS_SERVICE_NAME, WBEM_DEFAULT_HTTPS_PORT); |
portNumberHttps = System::lookupPort( |
|
WBEM_HTTPS_SERVICE_NAME, WBEM_DEFAULT_HTTPS_PORT); |
} else |
} |
|
else |
{ | { |
// | // |
// user-specified | // user-specified |
|
|
if(!(end != 0 && *end == '\0')) | if(!(end != 0 && *end == '\0')) |
{ | { |
InvalidPropertyValue e("httpsPort", httpsPort); | InvalidPropertyValue e("httpsPort", httpsPort); |
Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, |
Logger::put_l( |
|
Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, |
"src.Server.cimserver.SERVER_NOT_STARTED", | "src.Server.cimserver.SERVER_NOT_STARTED", |
"cimserver not started: $0", e.getMessage()); |
"cimserver not started: $0", |
MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED", |
e.getMessage()); |
"cimserver not started: $0", e.getMessage()); |
MessageLoaderParms parms( |
PEGASUS_STD(cerr) << argv[0] << ": " << MessageLoader::getMessage(parms) |
"src.Server.cimserver.SERVER_NOT_STARTED", |
<< PEGASUS_STD(endl); |
"cimserver not started: $0", |
|
e.getMessage()); |
|
PEGASUS_STD(cerr) << argv[0] << ": " << |
|
MessageLoader::getMessage(parms) << PEGASUS_STD(endl); |
exit(1); | exit(1); |
} | } |
} | } |
|
|
// | // |
// Look up the WBEM-HTTP port number | // Look up the WBEM-HTTP port number |
// | // |
portNumberHttp = System::lookupPort(WBEM_HTTP_SERVICE_NAME, WBEM_DEFAULT_HTTP_PORT); |
portNumberHttp = System::lookupPort( |
|
WBEM_HTTP_SERVICE_NAME, WBEM_DEFAULT_HTTP_PORT); |
} else |
} |
|
else |
{ | { |
// | // |
// user-specified | // user-specified |
|
|
if(!(end != 0 && *end == '\0')) | if(!(end != 0 && *end == '\0')) |
{ | { |
InvalidPropertyValue e("httpPort", httpPort); | InvalidPropertyValue e("httpPort", httpPort); |
Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, |
Logger::put_l( |
|
Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, |
"src.Server.cimserver.SERVER_NOT_STARTED", | "src.Server.cimserver.SERVER_NOT_STARTED", |
"cimserver not started: $0", e.getMessage()); |
"cimserver not started: $0", |
MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED", |
e.getMessage()); |
"cimserver not started: $0", e.getMessage()); |
MessageLoaderParms parms( |
PEGASUS_STD(cerr) << argv[0] << ": " << MessageLoader::getMessage(parms) |
"src.Server.cimserver.SERVER_NOT_STARTED", |
<< PEGASUS_STD(endl); |
"cimserver not started: $0", |
|
e.getMessage()); |
|
PEGASUS_STD(cerr) << argv[0] << ": " << |
|
MessageLoader::getMessage(parms) << PEGASUS_STD(endl); |
exit(1); | exit(1); |
} | } |
} | } |
} | } |
|
|
#if defined(PEGASUS_DEBUG) | #if defined(PEGASUS_DEBUG) |
// Put out startup up message. | // Put out startup up message. |
cout << _cimServerProcess->getProductName() << " " << _cimServerProcess->getCompleteVersion() << endl; |
cout << _cimServerProcess->getProductName() << " " << |
//l10n |
_cimServerProcess->getCompleteVersion() << endl; |
//cout << "Built " << __DATE__ << " " << __TIME__ << endl; |
|
//cout <<"Starting..." |
|
MessageLoaderParms parms("src.Server.cimserver.STARTUP_MESSAGE", | MessageLoaderParms parms("src.Server.cimserver.STARTUP_MESSAGE", |
"Built $0 $1\nStarting...", | "Built $0 $1\nStarting...", |
__DATE__, | __DATE__, |
__TIME__); | __TIME__); |
#endif | #endif |
| |
//l10n |
|
// reset message loading to NON-process locale | // reset message loading to NON-process locale |
MessageLoader::_useProcessLocale = false; | MessageLoader::_useProcessLocale = false; |
//l10n |
|
| |
// Get the parent's PID before forking | // Get the parent's PID before forking |
_serverRunStatus.setParentPid(System::getPID()); | _serverRunStatus.setParentPid(System::getPID()); |
| |
// Do not fork when using privilege separation (executor will daemonize itself |
// Do not fork when using privilege separation (executor will daemonize |
// later). |
// itself later). |
if (daemonOption) | if (daemonOption) |
{ | { |
if(-1 == _cimServerProcess->cimserver_fork()) | if(-1 == _cimServerProcess->cimserver_fork()) |
return(-1); |
return -1; |
} | } |
| |
// l10n |
|
// Now we are after the fork... | // Now we are after the fork... |
// Create a dummy Thread object that can be used to store the | // Create a dummy Thread object that can be used to store the |
// AcceptLanguageList object for CIM requests that are serviced | // AcceptLanguageList object for CIM requests that are serviced |
|
|
dummyInitialThread = new Thread(dummyThreadFunc, NULL, false); | dummyInitialThread = new Thread(dummyThreadFunc, NULL, false); |
Thread::setCurrent(dummyInitialThread); | Thread::setCurrent(dummyInitialThread); |
AcceptLanguageList default_al; | AcceptLanguageList default_al; |
try{ |
try |
|
{ |
default_al = LanguageParser::getDefaultAcceptLanguages(); | default_al = LanguageParser::getDefaultAcceptLanguages(); |
Thread::setLanguages(new AcceptLanguageList(default_al)); | Thread::setLanguages(new AcceptLanguageList(default_al)); |
}catch(InvalidAcceptLanguageHeader& e){ |
} |
|
catch (InvalidAcceptLanguageHeader& e) |
|
{ |
Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, | Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, |
"src.Server.cimserver.FAILED_TO_SET_PROCESS_LOCALE", | "src.Server.cimserver.FAILED_TO_SET_PROCESS_LOCALE", |
"Could not convert the system process locale into a valid AcceptLanguage format."); |
"Could not convert the system process locale into a valid " |
|
"AcceptLanguage format."); |
Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, | Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, |
e.getMessage()); | e.getMessage()); |
} | } |
|
|
// | // |
while( !_cimServer->terminated() ) | while( !_cimServer->terminated() ) |
{ | { |
|
|
_cimServer->runForever(); | _cimServer->runForever(); |
|
|
} | } |
| |
// | // |
|
|
{ | { |
Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, | Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, |
"src.Server.cimserver.ERROR", | "src.Server.cimserver.ERROR", |
"Error: $0", e.getMessage()); |
"Error: $0", |
MessageLoaderParms parms("src.Server.cimserver.ERROR", |
e.getMessage()); |
"Error: $0", e.getMessage()); |
MessageLoaderParms parms( |
PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl); |
"src.Server.cimserver.ERROR", |
|
"Error: $0", |
|
e.getMessage()); |
|
PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << |
|
PEGASUS_STD(endl); |
|
|
// | // |
// notify parent process (if there is a parent process) to terminate | // notify parent process (if there is a parent process) to terminate |
// | // |