version 1.147, 2005/01/29 06:23:55
|
version 1.150, 2005/02/06 21:28:25
|
|
|
//%2004//////////////////////////////////////////////////////////////////////// |
//%2005//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development | // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. | // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
|
// IBM Corp.; EMC Corporation, The Open Group. | // IBM Corp.; EMC Corporation, The Open Group. |
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; | // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. | // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// Modified By: Humberto Rivero (hurivero@us.ibm.com) | // Modified By: Humberto Rivero (hurivero@us.ibm.com) |
// | // |
// Modified By: Steve Hills (steve.hills@ncr.com) | // Modified By: Steve Hills (steve.hills@ncr.com) |
|
// Sean Keenan, Hewlett-Packard Company (sean.keenan@hp.com) |
// | // |
// Modified By: Amit K Arora, IBM (amitarora@in.ibm.com) - pep 167 | // Modified By: Amit K Arora, IBM (amitarora@in.ibm.com) - pep 167 |
// | // |
// Modified By: Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#2555 | // Modified By: Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#2555 |
// | // |
|
// Modified By: Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#2032 |
|
// |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
| |
|
|
# else | # else |
# include "cimserver_unix.cpp" | # include "cimserver_unix.cpp" |
#endif | #endif |
|
#elif defined(PEGASUS_OS_VMS) |
|
# include "cimserver_vms.cpp" |
#else | #else |
# error "Unsupported platform" | # error "Unsupported platform" |
#endif | #endif |
|
|
static const char OPTION_BINDVERBOSE = 'X'; | static const char OPTION_BINDVERBOSE = 'X'; |
#endif | #endif |
| |
|
# if defined(PEGASUS_OS_VMS) |
|
static const char OPTION_PORT = 'p'; |
|
|
|
static const char OPTION_TRACE = 't'; |
|
#endif |
|
|
static const String PROPERTY_TIMEOUT = "shutdownTimeout"; | static const String PROPERTY_TIMEOUT = "shutdownTimeout"; |
| |
ConfigManager* configManager; | ConfigManager* configManager; |
|
|
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 NT Service\n"); |
usage.append (" -install [name] - installs 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 (" -remove [name] - removes pegasus as a Windows NT Service\n"); |
usage.append (" -remove [name] - removes 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 (" -start [name] - starts pegasus as a Windows NT 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 (" -stop [name] - stops pegasus as a Windows NT 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\n"); | usage.append (" default CIM Server Service Name\n\n"); |
#endif | #endif |
|
|
cimserver_exitRC(1); | cimserver_exitRC(1); |
#endif | #endif |
| |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || 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_PLATFORM_SOLARIS_SPARC_CC) \ |
|
|| defined (PEGASUS_OS_VMS) |
if (kill_rc != -1) | if (kill_rc != -1) |
{ | { |
//l10n - TODO | //l10n - TODO |
|
|
argc -= 2; | argc -= 2; |
} | } |
#endif | #endif |
|
#if defined(PEGASUS_OS_VMS) |
|
else if (*option == OPTION_PORT) |
|
{ |
|
if (i + 1 < argc) |
|
{ |
|
newPortNumber.assign(argv[i + 1]); |
|
} |
|
else |
|
{ |
|
cout << "Missing argument for option -" << option << endl; |
|
exit(0); |
|
} |
|
|
|
memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*)); |
|
argc -= 2; |
|
} |
|
else if (*option == OPTION_TRACE) |
|
{ |
|
if (i + 1 < argc) |
|
{ |
|
pegasusTrace.assign(argv[i + 1]); |
|
} |
|
else |
|
{ |
|
cout << "Missing argument for option -" << option << endl; |
|
exit(0); |
|
} |
|
|
|
memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*)); |
|
argc -= 2; |
|
} |
|
#endif |
#if defined(PEGASUS_OS_HPUX) | #if defined(PEGASUS_OS_HPUX) |
// | // |
// Check to see if user asked for the version (-X option): | // Check to see if user asked for the version (-X option): |
|
|
{ | { |
String httpsPort = configManager->getCurrentValue("httpsPort"); | String httpsPort = configManager->getCurrentValue("httpsPort"); |
CString portString = httpsPort.getCString(); | CString portString = httpsPort.getCString(); |
|
#if defined(PEGASUS_OS_VMS) |
|
// if (!(newPortNumber == String::EMPTY)) |
|
if (!(newPortNumber == "")) |
|
{ |
|
portString = newPortNumber.getCString(); |
|
} |
|
#endif |
char* end = 0; | char* end = 0; |
Uint32 port = strtol(portString, &end, 10); | Uint32 port = strtol(portString, &end, 10); |
if(!(end != 0 && *end == '\0')) | if(!(end != 0 && *end == '\0')) |
|
|
{ | { |
String httpPort = configManager->getCurrentValue("httpPort"); | String httpPort = configManager->getCurrentValue("httpPort"); |
CString portString = httpPort.getCString(); | CString portString = httpPort.getCString(); |
|
#if defined(PEGASUS_OS_VMS) |
|
// if (!(newPortNumber == String::EMPTY)) |
|
if (!(newPortNumber == "")) |
|
{ |
|
portString = newPortNumber.getCString(); |
|
} |
|
#endif |
char* end = 0; | char* end = 0; |
Uint32 port = strtol(portString, &end, 10); | Uint32 port = strtol(portString, &end, 10); |
if(!(end != 0 && *end == '\0')) | if(!(end != 0 && *end == '\0')) |
|
|
#endif | #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) || defined (PEGASUS_OS_VMS) |
umask(S_IWGRP|S_IWOTH); | umask(S_IWGRP|S_IWOTH); |
| |
// | // |
|
|
| |
CimserverHolder cimserverHolder( &server ); | CimserverHolder cimserverHolder( &server ); |
| |
|
#if defined(PEGASUS_OS_VMS) |
|
// |
|
// Enable tracing at highest level |
|
// |
|
|
|
if (!(pegasusTrace == String::EMPTY)) |
|
{ |
|
Tracer::setTraceFile(pegasusTrace.getCString()); |
|
Tracer::setTraceLevel(Tracer::LEVEL4); |
|
Tracer::setTraceComponents("All"); |
|
} |
|
#endif |
if (enableHttpConnection) | if (enableHttpConnection) |
{ | { |
server.addAcceptor(false, portNumberHttp, false, false); | server.addAcceptor(false, portNumberHttp, false, false); |
|
|
| |
time_t last = 0; | time_t last = 0; |
| |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) || defined(PEGASUS_PLATFORM_SOLARIS_SPARC_CC) |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) \ |
|
|| defined(PEGASUS_OS_AIX) || defined(PEGASUS_PLATFORM_SOLARIS_SPARC_CC) \ |
|
|| defined(PEGASUS_OS_VMS) |
// | // |
// create a file to indicate that the cimserver has started and | // create a file to indicate that the cimserver has started and |
// save the process id of the cimserver process in the file | // save the process id of the cimserver process in the file |
|
|
Logger::INFORMATION, "src.Server.cimserver.STOPPED", | Logger::INFORMATION, "src.Server.cimserver.STOPPED", |
"$0 stopped.", PEGASUS_PRODUCT_NAME); | "$0 stopped.", PEGASUS_PRODUCT_NAME); |
| |
#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) || defined(PEGASUS_OS_VMS) |
// | // |
// close the file created at startup time to indicate that the | // close the file created at startup time to indicate that the |
// cimserver has terminated normally. | // cimserver has terminated normally. |