version 1.211.4.3, 2009/06/08 08:04:18
|
version 1.212, 2007/10/22 15:00:00
|
|
|
// | // |
// cimserver daemon=false | // cimserver daemon=false |
// | // |
// The daemon config property has no effect on windows operation or when |
// The daemon config property has no effect on windows operation. |
// privilege separation is enabled. |
|
// | // |
// To shutdown pegasus, use the -s option: | // To shutdown pegasus, use the -s option: |
// | // |
|
|
for (int i = 1; i < argc; ) | for (int i = 1; i < argc; ) |
{ | { |
const char* arg = argv[i]; | const char* arg = argv[i]; |
if (strcmp(arg, "--help") == 0) |
if (String::equal(arg,"--help")) |
{ | { |
PrintHelp(argv[0]); | PrintHelp(argv[0]); |
Executor::daemonizeExecutor(); |
|
exit(0); | exit(0); |
} | } |
else if (strcmp(arg, "--version") == 0) |
else if (String::equal(arg,"--version")) |
{ | { |
cout << _cimServerProcess->getCompleteVersion() << endl; | cout << _cimServerProcess->getCompleteVersion() << endl; |
Executor::daemonizeExecutor(); |
|
exit(0); | exit(0); |
} | } |
// Check for -option | // Check for -option |
|
|
strlen(option) == 1) | strlen(option) == 1) |
{ | { |
cout << _cimServerProcess->getCompleteVersion() << endl; | cout << _cimServerProcess->getCompleteVersion() << endl; |
Executor::daemonizeExecutor(); |
|
exit(0); | exit(0); |
} | } |
// | // |
|
|
(strlen(option) == 1)) | (strlen(option) == 1)) |
{ | { |
PrintHelp(argv[0]); | PrintHelp(argv[0]); |
Executor::daemonizeExecutor(); |
|
exit(0); | exit(0); |
} | } |
#if !defined(PEGASUS_USE_RELEASE_DIRS) | #if !defined(PEGASUS_USE_RELEASE_DIRS) |
|
|
"Missing argument for option -$0", | "Missing argument for option -$0", |
opt); | opt); |
cout << MessageLoader::getMessage(parms) << endl; | cout << MessageLoader::getMessage(parms) << endl; |
exit(1); |
exit(0); |
} | } |
| |
memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*)); | memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*)); |
|
|
"Duplicate shutdown option specified."); | "Duplicate shutdown option specified."); |
| |
cout << MessageLoader::getMessage(parms) << endl; | cout << MessageLoader::getMessage(parms) << endl; |
exit(1); |
exit(0); |
} | } |
| |
shutdownOption = true; | shutdownOption = true; |
|
|
daemonOption = ConfigManager::parseBooleanValue( | daemonOption = ConfigManager::parseBooleanValue( |
configManager->getCurrentValue("daemon")); | configManager->getCurrentValue("daemon")); |
| |
if ((Executor::detectExecutor() == 0) && (daemonOption == false)) |
|
{ |
|
MessageLoaderParms parms( |
|
"src.Server.cimserver.PRIVSEP_REQUIRES_DAEMON", |
|
"Warning: The configuration setting daemon=false is ignored " |
|
"with privilege separation enabled."); |
|
cerr << MessageLoader::getMessage(parms) << endl; |
|
daemonOption = true; |
|
} |
|
|
|
#if !defined(PEGASUS_USE_SYSLOGS) | #if !defined(PEGASUS_USE_SYSLOGS) |
String logsDirectory = ConfigManager::getHomedPath( | String logsDirectory = ConfigManager::getHomedPath( |
configManager->getCurrentValue("logdir")); | configManager->getCurrentValue("logdir")); |
|
|
configManager->getCurrentValue("shutdownTimeout"); | configManager->getCurrentValue("shutdownTimeout"); |
Uint32 timeoutValue = | Uint32 timeoutValue = |
strtol(configTimeout.getCString(), (char **)0, 10); | strtol(configTimeout.getCString(), (char **)0, 10); |
#ifdef PEGASUS_SLP_REG_TIMEOUT |
|
// To deregister Pegasus with SLP |
|
unregisterPegasusFromSLP(); |
|
#endif |
|
| |
ServerShutdownClient serverShutdownClient(&_serverRunStatus); | ServerShutdownClient serverShutdownClient(&_serverRunStatus); |
serverShutdownClient.shutdown(timeoutValue); | serverShutdownClient.shutdown(timeoutValue); |
|
|
// so user knows that there is cimserver ready to serve CIM requests. | // so user knows that there is cimserver ready to serve CIM requests. |
if (daemonOption) | if (daemonOption) |
{ | { |
|
#if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) |
|
Executor::daemonizeExecutor(); |
|
#else |
_cimServerProcess->notify_parent(0); | _cimServerProcess->notify_parent(0); |
|
#endif |
} | } |
| |
#if defined(PEGASUS_DEBUG) | #if defined(PEGASUS_DEBUG) |
|
|
MessageLoader::getMessage(parms)); | MessageLoader::getMessage(parms)); |
cerr << MessageLoader::getMessage(parms) << endl; | cerr << MessageLoader::getMessage(parms) << endl; |
| |
deleteCIMServer(); |
|
|
|
// | // |
// notify parent process (if there is a parent process) to terminate | // notify parent process (if there is a parent process) to terminate |
// | // |
if (daemonOption) | if (daemonOption) |
_cimServerProcess->notify_parent(1); | _cimServerProcess->notify_parent(1); |
| |
|
deleteCIMServer(); |
return 1; | return 1; |
} | } |
| |