version 1.211, 2007/09/10 08:17:07
|
version 1.211.2.13, 2007/10/09 21:41:40
|
|
|
#include <Pegasus/Common/Tracer.h> | #include <Pegasus/Common/Tracer.h> |
#include <Pegasus/Common/LanguageParser.h> | #include <Pegasus/Common/LanguageParser.h> |
#include <Pegasus/Config/ConfigManager.h> | #include <Pegasus/Config/ConfigManager.h> |
#include <Pegasus/Client/CIMClient.h> |
|
#include <Pegasus/Server/CIMServer.h> | #include <Pegasus/Server/CIMServer.h> |
#include <Service/ServerProcess.h> | #include <Service/ServerProcess.h> |
#include <Service/ServerShutdownClient.h> |
|
#include <Service/ServerRunStatus.h> | #include <Service/ServerRunStatus.h> |
| |
|
#if !defined(PEGASUS_REMOVE_SERVER_CLIENT_USAGE) |
|
# include <Pegasus/Client/CIMClient.h> |
|
# include <Service/ServerShutdownClient.h> |
|
#endif |
|
|
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) | #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) |
#include <Pegasus/Common/SetFileDescriptorToEBCDICEncoding.h> | #include <Pegasus/Common/SetFileDescriptorToEBCDICEncoding.h> |
#include <Service/ARM_zOS.h> | #include <Service/ARM_zOS.h> |
|
|
# endif | # endif |
#endif | #endif |
| |
#if defined(PEGASUS_OS_TYPE_UNIX) |
#if defined(PEGASUS_OS_TYPE_UNIX) || defined(PEGASUS_OS_VXWORKS) |
# include <unistd.h> | # include <unistd.h> |
# include <sys/types.h> | # include <sys/types.h> |
# include <sys/stat.h> | # include <sys/stat.h> |
|
|
#include <as400_protos.h> //for _SETCCSID | #include <as400_protos.h> //for _SETCCSID |
#endif | #endif |
| |
class CIMServerProcess : public ServerProcess |
class PEGASUS_SERVER_LINKAGE CIMServerProcess : public ServerProcess |
{ | { |
public: | public: |
| |
|
|
char** argv, | char** argv, |
Boolean shutdownOption) | Boolean shutdownOption) |
{ | { |
|
#if defined(PEGASUS_OS_VXWORKS) |
|
|
|
// VxWorks does not use configuration files. |
|
|
|
cm->mergeCommandLine(argc, argv); |
|
|
|
#else /* PEGASUS_OS_VXWORKS */ |
|
|
if (shutdownOption) | if (shutdownOption) |
{ | { |
cm->loadConfigFiles(); | cm->loadConfigFiles(); |
|
|
| |
// Enable updates again | // Enable updates again |
cm->useConfigFiles = true; | cm->useConfigFiles = true; |
|
|
|
#endif /* PEGASUS_OS_VXWORKS */ |
} | } |
| |
/* PrintHelp - This is temporary until we expand the options manager to allow | /* PrintHelp - This is temporary until we expand the options manager to allow |
|
|
// MAIN | // MAIN |
////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////// |
| |
int main(int argc, char** argv) |
extern "C" int PegasusServerMain(int argc, char** argv) |
{ | { |
String pegasusHome; | String pegasusHome; |
Boolean shutdownOption = false; | Boolean shutdownOption = false; |
|
|
// Set Message loading to process locale | // Set Message loading to process locale |
MessageLoader::_useProcessLocale = true; | MessageLoader::_useProcessLocale = true; |
| |
|
#if defined(PEGASUS_OS_VXWORKS) |
|
/* |
|
ATTN-MEB: create constant for this: |
|
*/ |
|
// On VxWorks, run cimserver in /ramfs:0 directory: |
|
{ |
|
const char PATH[] = "/romfs"; |
|
if (chdir(PATH) != 0) |
|
{ |
|
fprintf(stderr, "cimserver: failed to chdir to %s\n", PATH); |
|
fprintf(stderr, "cimserver: aborting...\n"); |
|
exit(1); |
|
} |
|
char cwd[4096]; |
|
cwd[0] = '\0'; |
|
getcwd(cwd, sizeof(cwd)); |
|
printf("Changed directory to \"%s\"\n", cwd); |
|
} |
|
#endif |
|
|
#ifdef PEGASUS_OS_ZOS | #ifdef PEGASUS_OS_ZOS |
// Direct standard input to /dev/null, | // Direct standard input to /dev/null, |
close(STDIN_FILENO); | close(STDIN_FILENO); |
|
|
// Get an instance of the Config Manager. | // Get an instance of the Config Manager. |
// | // |
ConfigManager* configManager = ConfigManager::getInstance(); | ConfigManager* configManager = ConfigManager::getInstance(); |
|
|
|
#if !defined(PEGASUS_OS_VXWORKS) |
configManager->useConfigFiles = true; | configManager->useConfigFiles = true; |
|
#endif |
| |
try | try |
{ | { |
|
|
// | // |
// Check to see if we should start Pegasus as a daemon | // Check to see if we should start Pegasus as a daemon |
// | // |
|
|
daemonOption = ConfigManager::parseBooleanValue( | daemonOption = ConfigManager::parseBooleanValue( |
configManager->getCurrentValue("daemon")); | configManager->getCurrentValue("daemon")); |
| |
|
|
#endif | #endif |
| |
// | // |
|
// Some platforms do not support using client to shutdown server. |
|
// |
|
#if !defined(PEGASUS_REMOVE_SERVER_CLIENT_USAGE) |
|
// |
// Check to see if we need to shutdown CIMOM | // Check to see if we need to shutdown CIMOM |
// | // |
if (shutdownOption) | if (shutdownOption) |
|
|
cout << MessageLoader::getMessage(parms) << endl; | cout << MessageLoader::getMessage(parms) << endl; |
return 0; | return 0; |
} | } |
|
#endif /* PEGASUS_REMOVE_SERVER_CLIENT_USAGE */ |
| |
#if defined(PEGASUS_DEBUG) && !defined(PEGASUS_USE_SYSLOGS) | #if defined(PEGASUS_DEBUG) && !defined(PEGASUS_USE_SYSLOGS) |
// Leave this in until people get familiar with the logs. | // Leave this in until people get familiar with the logs. |
|
|
e.getMessage()); | e.getMessage()); |
} | } |
| |
#ifndef PEGASUS_OS_TYPE_WINDOWS |
#if !defined(PEGASUS_OS_TYPE_WINDOWS) && !defined(PEGASUS_OS_VXWORKS) |
umask(S_IRWXG|S_IRWXO); | umask(S_IRWXG|S_IRWXO); |
#endif | #endif |
| |
|
|
try | try |
{ | { |
#if defined(PEGASUS_OS_TYPE_UNIX) | #if defined(PEGASUS_OS_TYPE_UNIX) |
|
|
|
// ATTN KS This file not used for VxWorks |
// | // |
// Lock the CIMSERVER_LOCK_FILE during CIM Server start-up to prevent | // Lock the CIMSERVER_LOCK_FILE during CIM Server start-up to prevent |
// concurrent writes to this file by multiple cimserver processes | // concurrent writes to this file by multiple cimserver processes |
|
|
AutoFileLock fileLock(startupLockFileName); | AutoFileLock fileLock(startupLockFileName); |
#endif | #endif |
| |
#if defined(PEGASUS_OS_TYPE_UNIX) || defined(PEGASUS_OS_VMS) |
#if defined(PEGASUS_OS_TYPE_UNIX) || \ |
|
defined(PEGASUS_OS_VMS) || \ |
|
defined(PEGASUS_OS_VXWORKS) |
// | // |
// Check if a CIM Server is already running. If so, print an error | // Check if a CIM Server is already running. If so, print an error |
// message and notify the parent process (if there is one) to terminate | // message and notify the parent process (if there is one) to terminate |
|
|
#endif | #endif |
} | } |
| |
|
#if defined(PEGASUS_OS_VXWORKS) |
|
cout << "Started CIM Server." << endl; |
|
#endif |
|
|
#if defined(PEGASUS_DEBUG) | #if defined(PEGASUS_DEBUG) |
cout << "Started. " << endl; | cout << "Started. " << endl; |
#endif | #endif |
|
|
deleteCIMServer(); | deleteCIMServer(); |
return 0; | return 0; |
} | } |
|
|
|
#if !defined(PEGASUS_BUILDING_CIMSERVER_LIBRARY) |
|
|
|
int main(int argc, char** argv) |
|
{ |
|
return PegasusServerMain(argc, argv); |
|
} |
|
|
|
#endif /* PEGASUS_BUILDING_CIMSERVER_LIBRARY */ |