version 1.175.2.1, 2006/01/18 17:38:07
|
version 1.176, 2006/01/10 19:41:21
|
|
|
# include "OS400ConvertChar.h" | # include "OS400ConvertChar.h" |
#endif | #endif |
| |
#if defined(PEGASUS_OS_TYPE_UNIX) |
|
# if defined(PEGASUS_OS_OS400) | # if defined(PEGASUS_OS_OS400) |
# include <unistd.cleinc> | # include <unistd.cleinc> |
# else |
#elif defined(PEGASUS_OS_TYPE_UNIX) |
# include <unistd.h> | # include <unistd.h> |
# endif | # endif |
# include <sys/types.h> |
|
# include <sys/stat.h> |
|
# include <fcntl.h> |
|
#endif |
|
| |
PEGASUS_USING_PEGASUS; | PEGASUS_USING_PEGASUS; |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
|
|
return CIMSERVER_START_FILE; | return CIMSERVER_START_FILE; |
} | } |
| |
int cimserver_run( |
int cimserver_run(int argc, char** argv, bool shutdownOption); |
int argc, |
|
char** argv, |
|
Boolean shutdownOption, |
|
Boolean debugOutputOption); |
|
| |
void cimserver_stop(void); | void cimserver_stop(void); |
}; | }; |
|
|
| |
static const char LONG_VERSION [] = "version"; | static const char LONG_VERSION [] = "version"; |
| |
static const char OPTION_DEBUGOUTPUT = 'X'; |
#if defined(PEGASUS_OS_HPUX) |
|
static const char OPTION_BINDVERBOSE = 'X'; |
|
#endif |
| |
static const String PROPERTY_TIMEOUT = "shutdownTimeout"; | static const String PROPERTY_TIMEOUT = "shutdownTimeout"; |
| |
|
|
{ | { |
String pegasusHome = String::EMPTY; | String pegasusHome = String::EMPTY; |
Boolean shutdownOption = false; | Boolean shutdownOption = false; |
Boolean debugOutputOption = false; |
|
| |
//l10n | //l10n |
// Set Message loading to process locale | // Set Message loading to process locale |
|
|
argc -= 2; | argc -= 2; |
} | } |
#endif | #endif |
|
#if defined(PEGASUS_OS_HPUX) |
// | // |
// Check to see if user asked for debug output (-X option): |
// Check to see if user asked for the version (-X option): |
// | // |
else if (*option == OPTION_DEBUGOUTPUT && |
if (*option == OPTION_BINDVERBOSE && |
(strlen(option) == 1)) | (strlen(option) == 1)) |
{ | { |
MessageLoaderParms parms( |
|
"src.Server.cimserver.UNSUPPORTED_DEBUG_OPTION", |
|
"Unsupported debug output option is enabled."); |
|
cout << MessageLoader::getMessage(parms) << endl; |
|
|
|
debugOutputOption = true; |
|
|
|
#if defined(PEGASUS_OS_HPUX) |
|
System::bindVerbose = true; | System::bindVerbose = true; |
#endif |
//l10n |
|
//cout << "Unsupported debug option, BIND_VERBOSE, enabled." |
|
//<< endl; |
|
MessageLoaderParms parms("src.Server.cimserver.UNSUPPORTED_DEBUG_OPTION", |
|
"Unsupported debug option, BIND_VERBOSE, enabled."); |
|
cout << MessageLoader::getMessage(parms) << endl; |
// remove the option from the command line | // remove the option from the command line |
memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*)); | memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*)); |
argc--; | argc--; |
} | } |
|
#endif |
// | // |
// Check to see if user asked for shutdown (-s option): | // Check to see if user asked for shutdown (-s option): |
// | // |
|
|
// Do the platform specific run | // Do the platform specific run |
// | // |
| |
return _cimServerProcess->platform_run( |
return _cimServerProcess->platform_run( argc, argv, shutdownOption ); |
argc, argv, shutdownOption, debugOutputOption); |
|
} | } |
| |
void CIMServerProcess::cimserver_stop() | void CIMServerProcess::cimserver_stop() |
|
|
// specific runs may need to deal with better (instead of exit(), etc). | // specific runs may need to deal with better (instead of exit(), etc). |
// | // |
| |
int CIMServerProcess::cimserver_run( |
int CIMServerProcess::cimserver_run( int argc, char** argv, Boolean shutdownOption ) |
int argc, |
|
char** argv, |
|
Boolean shutdownOption, |
|
Boolean debugOutputOption) |
|
{ | { |
String logsDirectory = String::EMPTY; | String logsDirectory = String::EMPTY; |
Boolean daemonOption = false; | Boolean daemonOption = false; |
|
|
| |
FILE *startupLockFile; | FILE *startupLockFile; |
| |
if ((startupLockFile = fopen(ConfigManager::getHomedPath( |
if (startupLockFile = fopen(ConfigManager::getHomedPath(CIMSERVER_LOCK_FILE).getCString(), "w")) |
CIMSERVER_LOCK_FILE).getCString(), "w")) != 0) |
|
{ | { |
lockf(fileno(startupLockFile), F_LOCK, 0); | lockf(fileno(startupLockFile), F_LOCK, 0); |
} | } |
|
|
"Started $0 version $1.", | "Started $0 version $1.", |
_cimServerProcess->getProductName(), _cimServerProcess->getVersion()); | _cimServerProcess->getProductName(), _cimServerProcess->getVersion()); |
| |
#if defined(PEGASUS_OS_TYPE_UNIX) |
|
if (daemonOption && !debugOutputOption) |
|
{ |
|
// Direct standard input, output, and error to /dev/null, |
|
// since we are running as a daemon. |
|
close(0); |
|
open("/dev/null", O_RDONLY); |
|
close(1); |
|
open("/dev/null", O_RDWR); |
|
close(2); |
|
open("/dev/null", O_RDWR); |
|
} |
|
#endif |
|
|
|
// | // |
// Loop to call CIMServer's runForever() method until CIMServer | // Loop to call CIMServer's runForever() method until CIMServer |
// has been shutdown | // has been shutdown |