(file) Return to cimserver.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Server

   1 karl  1.149 //%2005////////////////////////////////////////////////////////////////////////
   2 mike  1.32  //
   3 karl  1.141 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
   4             // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   5             // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   6 karl  1.121 // IBM Corp.; EMC Corporation, The Open Group.
   7 karl  1.141 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   8             // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   9 karl  1.149 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  10             // EMC Corporation; VERITAS Software Corporation; The Open Group.
  11 mike  1.32  //
  12             // Permission is hereby granted, free of charge, to any person obtaining a copy
  13 kumpf 1.58  // of this software and associated documentation files (the "Software"), to
  14             // deal in the Software without restriction, including without limitation the
  15             // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  16 mike  1.32  // sell copies of the Software, and to permit persons to whom the Software is
  17             // furnished to do so, subject to the following conditions:
  18 david.dillard 1.165 //
  19 kumpf         1.58  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
  20 mike          1.32  // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
  21                     // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  22 kumpf         1.58  // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  23                     // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  24                     // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  25 mike          1.32  // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  26                     // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27                     //
  28                     //==============================================================================
  29                     //
  30                     // Author: Mike Brasher (mbrasher@bmc.com)
  31                     //
  32 david.dillard 1.165 // Modified By: Mike Day (mdday@us.ibm.com)
  33                     //              Karl Schopmeyer (k.schopmeyer@opengroup.org)
  34                     //              Nag Boranna (nagaraja_boranna@hp.com)
  35                     //              Jenny Yu (jenny_yu@hp.com)
  36                     //              Sushma Fernandes (sushma_fernandes@hp.com)
  37 kumpf         1.72  //              Carol Ann Krug Graves, Hewlett-Packard Company
  38 david.dillard 1.165 //                  (carolann_graves@hp.com)
  39                     //              Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
  40                     //              Dave Rosckes (rosckes@us.ibm.com)
  41                     //              Humberto Rivero (hurivero@us.ibm.com)
  42                     //              Steve Hills (steve.hills@ncr.com)
  43 gs.keenan     1.150 //              Sean Keenan, Hewlett-Packard Company (sean.keenan@hp.com)
  44 david.dillard 1.165 //              Amit K Arora, IBM (amitarora@in.ibm.com) - pep 167
  45                     //              Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#2555
  46                     //              Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#2032
  47                     //              Heather Sterling, IBM (hsterl@us.ibm.com) - PEP#222
  48                     //              Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#3452
  49                     //              David Dillard, VERITAS Software Corp.
  50                     //                  (david.dillard@veritas.com)
  51 aruran.ms     1.173 //              Aruran, IBM (ashanmug@in.ibm.com) for Bug# 4183
  52 joyce.j       1.160 //
  53 mike          1.32  //%/////////////////////////////////////////////////////////////////////////////
  54                     
  55                     
  56                     //////////////////////////////////////////////////////////////////////
  57                     //
  58 carolann.graves 1.171 // Notes on daemon operation (Unix) and service operation (Win 32):
  59 mike            1.32  //
  60 david.dillard   1.165 // To run pegasus as a daemon on Unix platforms:
  61 mike            1.32  //
  62 kumpf           1.60  // cimserver
  63 mike            1.32  //
  64 kumpf           1.60  // To NOT run pegasus as a daemon on Unix platforms, set the daemon config
  65                       // property to false:
  66                       //
  67                       // cimserver daemon=false
  68                       //
  69 david.dillard   1.165 // The daemon config property has no effect on windows operation.
  70 mike            1.32  //
  71 mike            1.35  // To shutdown pegasus, use the -s option:
  72 david.dillard   1.165 //
  73                       // cimserver -s
  74 mike            1.35  //
  75 mike            1.32  // To run pegasus as an NT service, there are FOUR  different possibilities:
  76                       //
  77 david.dillard   1.165 // To INSTALL the Pegasus service,
  78 mike            1.32  //
  79                       // cimserver -install
  80                       //
  81 david.dillard   1.165 // To REMOVE the Pegasus service,
  82 mike            1.32  //
  83                       // cimserver -remove
  84                       //
  85 david.dillard   1.165 // To START the Pegasus service,
  86 mike            1.32  //
  87                       // net start cimserver
  88 s.hills         1.117 // or
  89                       // cimserver -start
  90 mike            1.32  //
  91 david.dillard   1.165 // To STOP the Pegasus service,
  92 mike            1.32  //
  93                       // net stop cimserver
  94 s.hills         1.117 // or
  95                       // cimserver -stop
  96 mike            1.32  //
  97 david.dillard   1.165 // Alternatively, you can use the windows service manager. Pegasus shows up
  98 mike            1.32  // in the service database as "Pegasus CIM Object Manager"
  99                       //
 100                       // Mike Day, mdday@us.ibm.com
 101 david.dillard   1.165 //
 102 mike            1.32  //////////////////////////////////////////////////////////////////////
 103                       
 104                       
 105 mike            1.35  #include <Pegasus/Common/Config.h>
 106 kumpf           1.59  #include <Pegasus/Common/Constants.h>
 107 jim.wunderlich  1.172 #include <Pegasus/Common/PegasusAssert.h>
 108 mike            1.32  #include <cstdlib>
 109                       #include <Pegasus/Common/FileSystem.h>
 110 mike            1.35  #include <Pegasus/Common/Monitor.h>
 111 mike            1.32  #include <Pegasus/Common/PegasusVersion.h>
 112                       #include <Pegasus/Common/Logger.h>
 113                       #include <Pegasus/Common/System.h>
 114 mike            1.35  #include <Pegasus/Common/Tracer.h>
 115 kumpf           1.174 #include <Pegasus/Common/LanguageParser.h>
 116 mike            1.35  #include <Pegasus/Config/ConfigManager.h>
 117                       #include <Pegasus/Client/CIMClient.h>
 118                       #include <Pegasus/Server/ShutdownService.h>
 119 h.sterling      1.153 #include <Pegasus/Server/CIMServer.h>
 120                       #include <Service/ServerProcess.h>
 121 mike            1.32  
 122 chuck           1.155 #if defined(PEGASUS_OS_OS400)
 123                       #  include "vfyptrs.cinc"
 124                       #  include "OS400ConvertChar.h"
 125                       #endif
 126                       
 127 kumpf           1.119 PEGASUS_USING_PEGASUS;
 128                       PEGASUS_USING_STD;
 129                       
 130 h.sterling      1.153 #define PEGASUS_PROCESS_NAME "cimserver";
 131 mike            1.32  
 132 h.sterling      1.153 //Windows service variables are not defined elsewhere in the product
 133                       //enable ability to override these
 134                       #ifndef PEGASUS_SERVICE_NAME
 135                       #define PEGASUS_SERVICE_NAME "Pegasus CIM Object Manager";
 136 chuck           1.66  #endif
 137 h.sterling      1.153 #ifndef PEGASUS_SERVICE_DESCRIPTION
 138                       #define PEGASUS_SERVICE_DESCRIPTION "Pegasus CIM Object Manager Service";
 139 mike            1.32  #endif
 140                       
 141 h.sterling      1.153 class CIMServerProcess : public ServerProcess
 142                       {
 143                       public:
 144                       
 145                           CIMServerProcess(void)
 146                           {
 147                               cimserver_set_process(this);
 148                           }
 149                       
 150                           virtual ~CIMServerProcess(void)
 151                           {
 152                           }
 153                       
 154                           //defined in PegasusVersion.h
 155                           virtual const char* getProductName() const
 156                           {
 157                               return PEGASUS_PRODUCT_NAME;
 158                           }
 159                       
 160                           virtual const char* getExtendedName() const
 161                           {
 162 h.sterling      1.153         return PEGASUS_SERVICE_NAME;
 163                           }
 164                       
 165                           virtual const char* getDescription() const
 166                           {
 167                               return PEGASUS_SERVICE_DESCRIPTION;
 168                           }
 169 david.dillard   1.165 
 170 h.sterling      1.153     //defined in PegasusVersion.h
 171                           virtual const char* getVersion() const
 172                           {
 173                               return PEGASUS_PRODUCT_VERSION;
 174                           }
 175                       
 176                           virtual const char* getProcessName() const
 177                           {
 178                               return PEGASUS_PROCESS_NAME;
 179                           }
 180                       
 181                           //defined in ConfigFileDir.h
 182                           virtual const char* getPIDFileName() const
 183                           {
 184                               return CIMSERVER_START_FILE;
 185                           }
 186                       
 187                           int cimserver_run(int argc, char** argv, bool shutdownOption);
 188                       
 189                           void cimserver_stop(void);
 190                       };
 191 h.sterling      1.153 
 192                       AutoPtr<CIMServerProcess> _cimServerProcess(new CIMServerProcess());
 193                       static CIMServer* _cimServer = 0;
 194 konrad.r        1.163 static Monitor* _monitor = 0;
 195 konrad.r        1.166 static Thread* dummyInitialThread = 0;
 196 mike            1.35  //
 197                       //  The command name.
 198                       //
 199                       static const char COMMAND_NAME []    = "cimserver";
 200                       
 201                       //
 202                       //  The constant defining usage string.
 203                       //
 204                       static const char USAGE []           = "Usage: ";
 205                       
 206                       /**
 207                       Constants representing the command line options.
 208                       */
 209                       static const char OPTION_VERSION     = 'v';
 210                       
 211                       static const char OPTION_HELP        = 'h';
 212                       
 213                       static const char OPTION_HOME        = 'D';
 214                       
 215                       static const char OPTION_SHUTDOWN    = 's';
 216                       
 217 a.arora         1.142 static const char   LONG_HELP []  = "help";
 218                       
 219                       static const char   LONG_VERSION []  = "version";
 220                       
 221 kumpf           1.48  #if defined(PEGASUS_OS_HPUX)
 222                       static const char OPTION_BINDVERBOSE = 'X';
 223                       #endif
 224                       
 225 kumpf           1.54  static const String PROPERTY_TIMEOUT = "shutdownTimeout";
 226 mike            1.35  
 227                       ConfigManager*    configManager;
 228                       
 229 mike            1.32  /** GetOptions function - This function defines the Options Table
 230 mike            1.35      and sets up the options from that table using the config manager.
 231 mike            1.32  */
 232                       void GetOptions(
 233 mike            1.35      ConfigManager* cm,
 234 mike            1.32      int& argc,
 235 s.hills         1.117     char** argv)
 236 mike            1.32  {
 237 mike            1.35      try
 238 mike            1.32      {
 239 kumpf           1.38          cm->mergeConfigFiles();
 240 mike            1.33  
 241 mike            1.35          cm->mergeCommandLine(argc, argv);
 242                           }
 243 kumpf           1.122     catch (NoSuchFile&)
 244 mike            1.35      {
 245 kumpf           1.122         throw;
 246 mike            1.35      }
 247 kumpf           1.122     catch (FileNotReadable&)
 248 mike            1.35      {
 249 kumpf           1.122         throw;
 250 mike            1.35      }
 251 kumpf           1.122     catch (CannotRenameFile&)
 252 mike            1.35      {
 253 kumpf           1.122         throw;
 254 mike            1.35      }
 255 kumpf           1.122     catch (ConfigFileSyntaxError&)
 256 mike            1.35      {
 257 kumpf           1.122         throw;
 258 mike            1.35      }
 259 kumpf           1.122     catch(UnrecognizedConfigProperty&)
 260 mike            1.35      {
 261 kumpf           1.122         throw;
 262 mike            1.35      }
 263 kumpf           1.122     catch(InvalidPropertyValue&)
 264 mike            1.35      {
 265 kumpf           1.122         throw;
 266 mike            1.35      }
 267 kumpf           1.123     catch (CannotOpenFile&)
 268                           {
 269                               throw;
 270                           }
 271 mike            1.32  }
 272                       
 273                       /* PrintHelp - This is temporary until we expand the options manager to allow
 274                          options help to be defined with the OptionRow entries and presented from
 275                          those entries.
 276                       */
 277                       void PrintHelp(const char* arg0)
 278                       {
 279 mike            1.35      String usage = String (USAGE);
 280                           usage.append (COMMAND_NAME);
 281                           usage.append (" [ [ options ] | [ configProperty=value, ... ] ]\n");
 282                           usage.append ("  options\n");
 283 a.arora         1.142     usage.append ("    -v, --version   - displays CIM Server version number\n");
 284                           usage.append ("    -h, --help      - prints this help message\n");
 285 humberto        1.97      usage.append ("    -s              - shuts down CIM Server\n");
 286 kumpf           1.138 #if !defined(PEGASUS_USE_RELEASE_DIRS)
 287                           usage.append ("    -D [home]       - sets pegasus home directory\n");
 288 humberto        1.97  #endif
 289                       #if defined(PEGASUS_OS_TYPE_WINDOWS)
 290 joyce.j         1.148     usage.append ("    -install [name] - installs pegasus as a Windows Service\n");
 291 humberto        1.97      usage.append ("                      [name] is optional and overrides the\n");
 292                           usage.append ("                      default CIM Server Service Name\n");
 293 joyce.j         1.148     usage.append ("    -remove [name]  - removes pegasus as a Windows Service\n");
 294 humberto        1.97      usage.append ("                      [name] is optional and overrides the\n");
 295                           usage.append ("                      default CIM Server Service Name\n");
 296 joyce.j         1.148     usage.append ("    -start [name]   - starts pegasus as a Windows Service\n");
 297 humberto        1.97      usage.append ("                      [name] is optional and overrides the\n");
 298                           usage.append ("                      default CIM Server Service Name\n");
 299 joyce.j         1.148     usage.append ("    -stop [name]    - stops pegasus as a Windows Service\n");
 300 humberto        1.97      usage.append ("                      [name] is optional and overrides the\n");
 301                           usage.append ("                      default CIM Server Service Name\n\n");
 302                       #endif
 303                           usage.append ("  configProperty=value\n");
 304                           usage.append ("                    - sets CIM Server configuration property\n");
 305                       
 306                           cout << endl;
 307 h.sterling      1.153     cout << _cimServerProcess->getProductName() << " " << _cimServerProcess->getVersion() << endl;
 308 humberto        1.97      cout << endl;
 309 david.dillard   1.165 
 310 humberto        1.97  #if defined(PEGASUS_OS_TYPE_WINDOWS)
 311 humberto        1.104     MessageLoaderParms parms("src.Server.cimserver.MENU.WINDOWS", usage);
 312 kumpf           1.152 #elif defined(PEGASUS_USE_RELEASE_DIRS)
 313 kumpf           1.138     MessageLoaderParms parms("src.Server.cimserver.MENU.HPUXLINUXIA64GNU", usage);
 314 humberto        1.97  #else
 315 kumpf           1.138     MessageLoaderParms parms("src.Server.cimserver.MENU.STANDARD", usage);
 316 humberto        1.97  #endif
 317                           cout << MessageLoader::getMessage(parms) << endl;
 318 mike            1.35  }
 319                       
 320 h.sterling      1.156 //This needs to be called at various points in the code depending on the platform and error conditions.
 321                       //We need to delete the _cimServer reference on exit in order for the destructors to get called.
 322                       void deleteCIMServer()
 323                       {
 324                           if (_cimServer)
 325                           {
 326                               delete _cimServer;
 327                               _cimServer = 0;
 328 carolann.graves 1.171 
 329                       #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) \
 330                       || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) \
 331                       || defined(PEGASUS_OS_SOLARIS) || defined(PEGASUS_OS_VMS)
 332                               //
 333                               //  Remove the PID file to indicate CIMServer termination
 334                               //
 335                               FileSystem::removeFile(_cimServerProcess->getPIDFileName());
 336                       #endif
 337 h.sterling      1.156     }
 338 konrad.r        1.163    if (_monitor)
 339                          {
 340                       	delete _monitor;
 341                          }
 342 konrad.r        1.166    if (dummyInitialThread)
 343                          {
 344                       	Thread::clearLanguages();
 345                       	delete dummyInitialThread;
 346                          }
 347 h.sterling      1.156 }
 348                       
 349 chuck           1.96  // l10n
 350                       //
 351                       // Dummy function for the Thread object associated with the initial thread.
 352                       // Since the initial thread is used to process CIM requests, this is
 353                       // needed to localize the exceptions thrown during CIM request processing.
 354 david.dillard   1.165 // Note: This function should never be called!
 355                       //
 356 chuck           1.96  PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL dummyThreadFunc(void *parm)
 357                       {
 358 david.dillard   1.165    return((PEGASUS_THREAD_RETURN)0);
 359 chuck           1.96  }
 360                       
 361 carolann.graves 1.171 //
 362                       //  Waits until either the CIM Server has terminated, or the shutdown timeout
 363                       //  has expired.  If the shutdown timeout has expired, and the CIM Server is
 364                       //  still running, kills the cimserver process.
 365                       //
 366                       void _waitForTerminationOrTimeout (Uint32 maxWaitTime)
 367                       {
 368                           //
 369                           //  If the CIM Server is still running, and the shutdown timeout has not
 370                           //  expired, loop and wait one second until either the CIM Server has
 371                           //  terminated, or the shutdown timeout has expired
 372                           //
 373                           Boolean running = _cimServerProcess->isCIMServerRunning ();
 374                           while (running && (maxWaitTime > 0))
 375                           {
 376                               System::sleep (1);
 377                               running = _cimServerProcess->isCIMServerRunning ();
 378                               maxWaitTime--;
 379                           }
 380                       
 381                           //
 382 carolann.graves 1.171     //  If the shutdown timeout has expired, and the CIM Server is still
 383                           //  running, kill the cimserver process
 384                           //
 385                           if (running)
 386                           {
 387                               int kill_rc = _cimServerProcess->cimserver_kill (0);
 388                       
 389                       #ifdef PEGASUS_OS_OS400
 390                               if (kill_rc == -1)
 391                               {
 392                                   _cimServerProcess->cimserver_exitRC (2);
 393                               }
 394                               _cimServerProcess->cimserver_exitRC (1);
 395                       #endif
 396                       
 397                       #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) \
 398                       || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_SOLARIS) \
 399                       || defined (PEGASUS_OS_VMS)
 400                               if (kill_rc != -1)
 401                               {
 402                                   //l10n - TODO
 403 carolann.graves 1.171             Logger::put_l (Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
 404                                       "src.Server.cimserver.TIMEOUT_EXPIRED_SERVER_KILLED",
 405                                       "Shutdown timeout expired.  Forced shutdown initiated.");
 406                                   MessageLoaderParms parms
 407                                       ("src.Server.cimserver.TIMEOUT_EXPIRED_SERVER_KILLED",
 408                                       "Shutdown timeout expired.  Forced shutdown initiated.");
 409                                   cout << MessageLoader::getMessage(parms) << endl;
 410                                   exit (0);
 411                               }
 412                       #endif
 413                           }
 414                       }
 415                       
 416 kumpf           1.52  void shutdownCIMOM(Uint32 timeoutValue)
 417 mike            1.35  {
 418                           //
 419                           // Create CIMClient object
 420                           //
 421 kumpf           1.42      CIMClient client;
 422 mike            1.35  
 423                           //
 424 kumpf           1.53      // Get local host name
 425 mike            1.35      //
 426                           String hostStr = System::getHostName();
 427                       
 428                           //
 429 david.dillard   1.165     // open connection to CIMOM
 430 mike            1.35      //
 431                           try
 432                           {
 433 kumpf           1.43          client.connectLocal();
 434 kumpf           1.52  
 435                               //
 436 kumpf           1.63          // set client timeout to 2 seconds
 437 kumpf           1.52          //
 438 kumpf           1.71          client.setTimeout(2000);
 439 mike            1.35      }
 440 s.hills         1.117     catch(Exception&)
 441 mike            1.35      {
 442 david           1.85  #ifdef PEGASUS_OS_OS400
 443 h.sterling      1.153     //l10n
 444                           //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
 445                                   //"Unable to connect to CIM Server.  CIM Server may not be running." );
 446                           Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
 447                                   "src.Server.cimserver.UNABLE_CONNECT_SERVER_MAY_NOT_BE_RUNNING",
 448                                   "Unable to connect to CIM Server.  CIM Server may not be running." );
 449                           // The server job may still be active but not responding.
 450                           // Kill the job if it exists.
 451                           if(_cimServerProcess->cimserver_kill(0) == -1)
 452                              _cimServerProcess->cimserver_exitRC(2);
 453                           _cimServerProcess->cimserver_exitRC(1);
 454 david           1.85  #else
 455 humberto        1.97          //l10n
 456                               //PEGASUS_STD(cerr) << "Unable to connect to CIM Server." << PEGASUS_STD(endl);
 457                               //PEGASUS_STD(cerr) << "CIM Server may not be running." << PEGASUS_STD(endl);
 458                               MessageLoaderParms parms("src.Server.cimserver.UNABLE_CONNECT_SERVER_MAY_NOT_BE_RUNNING",
 459 kumpf           1.105                                                          "Unable to connect to CIM Server.\nCIM Server may not be running.\n");
 460 humberto        1.97          PEGASUS_STD(cerr) << MessageLoader::getMessage(parms);
 461 s.hills         1.117         exit(1);
 462 chuck           1.66  #endif
 463 mike            1.35      }
 464                       
 465                           try
 466                           {
 467                               //
 468 kumpf           1.52          // construct CIMObjectPath
 469 mike            1.35          //
 470                               String referenceStr = "//";
 471                               referenceStr.append(hostStr);
 472 david.dillard   1.165         referenceStr.append("/");
 473 kumpf           1.72          referenceStr.append(PEGASUS_NAMESPACENAME_SHUTDOWN.getString());
 474 kumpf           1.53          referenceStr.append(":");
 475 kumpf           1.72          referenceStr.append(PEGASUS_CLASSNAME_SHUTDOWN.getString());
 476 kumpf           1.50          CIMObjectPath reference(referenceStr);
 477 mike            1.35  
 478                               //
 479                               // issue the invokeMethod request on the shutdown method
 480                               //
 481                               Array<CIMParamValue> inParams;
 482                               Array<CIMParamValue> outParams;
 483                       
 484 kumpf           1.52          // set force option to true for now
 485 kumpf           1.40          inParams.append(CIMParamValue("force",
 486 kumpf           1.52              CIMValue(Boolean(true))));
 487 mike            1.35  
 488 kumpf           1.40          inParams.append(CIMParamValue("timeout",
 489 kumpf           1.39              CIMValue(Uint32(timeoutValue))));
 490 mike            1.35  
 491                               CIMValue retValue = client.invokeMethod(
 492 kumpf           1.59              PEGASUS_NAMESPACENAME_SHUTDOWN,
 493 mike            1.35              reference,
 494                                   "shutdown",
 495                                   inParams,
 496                                   outParams);
 497 kumpf           1.43      }
 498 kumpf           1.65      catch(CIMException& e)
 499 kumpf           1.46      {
 500 david           1.85  #ifdef PEGASUS_OS_OS400
 501                       
 502 h.sterling      1.153     if (e.getCode() == CIM_ERR_INVALID_NAMESPACE)
 503                           {
 504                               //l10n
 505                               //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
 506                                   //"Failed to shutdown server: $0", "The repository may be empty.");
 507                               Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
 508                                   "src.Server.cimserver.SHUTDOWN_FAILED_REPOSITORY_EMPTY",
 509                                   "Error in server shutdown: The repository may be empty.");
 510                           }
 511                           else
 512                           {
 513                               //l10n
 514                               //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
 515                                   //"Failed to shutdown server: $0", e.getMessage());
 516                               Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
 517                                   "src.Server.cimserver.SHUTDOWN_FAILED",
 518                                   "Error in server shutdown: $0", e.getMessage());
 519                           }
 520                           // Kill the server job.
 521                           if(_cimServerProcess->cimserver_kill(0) == -1)
 522                              _cimServerProcess->cimserver_exitRC(2);
 523 david           1.85  #else
 524 kumpf           1.105         //l10n - TODO
 525 humberto        1.97          MessageLoaderParms parms("src.Server.cimserver.SHUTDOWN_FAILED",
 526 kumpf           1.105                                  "Error in server shutdown: ");
 527 humberto        1.97          PEGASUS_STD(cerr) << MessageLoader::getMessage(parms);
 528 kumpf           1.63          if (e.getCode() == CIM_ERR_INVALID_NAMESPACE)
 529                               {
 530 kumpf           1.105             //
 531 david.dillard   1.165             // Repository may be empty.
 532 kumpf           1.105             //
 533                                   //l10n - TODO
 534                                   Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
 535                                       "src.Server.cimserver.SHUTDOWN_FAILED_REPOSITORY_EMPTY",
 536                                       "Error in server shutdown: The repository may be empty.");
 537 humberto        1.97              MessageLoaderParms parms("src.Server.cimserver.REPOSITORY_EMPTY",
 538 kumpf           1.105                                      "The repository may be empty.");
 539                                   PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);
 540 kumpf           1.63          }
 541                               else
 542                               {
 543 kumpf           1.105             //l10n - TODO
 544                                   Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
 545                                       "src.Server.cimserver.SHUTDOWN_FAILED",
 546                                       "Error in server shutdown: $0", e.getMessage());
 547 kumpf           1.63              PEGASUS_STD(cerr) << e.getMessage() << PEGASUS_STD(endl);
 548                               }
 549 kumpf           1.105 
 550 david.dillard   1.165     // Kill the cimserver process
 551 h.sterling      1.153     if (_cimServerProcess->cimserver_kill(0) == 0)
 552 kumpf           1.105         {
 553                                   //l10n - TODO
 554                                   Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
 555                                       "src.Server.cimserver.SERVER_FORCED_SHUTDOWN",
 556 h.sterling      1.153             "Forced shutdown initiated.");
 557 kumpf           1.105             MessageLoaderParms parms("src.Server.cimserver.SERVER_FORCED_SHUTDOWN",
 558                                                            "Forced shutdown initiated.");
 559                                   PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);
 560                               }
 561 s.hills         1.117         exit(1);
 562 chuck           1.66  #endif
 563 kumpf           1.46      }
 564 s.hills         1.117     catch(Exception&)
 565 kumpf           1.45      {
 566                               //
 567 kumpf           1.91          // This may mean that the CIM Server has terminated, causing this
 568                               // client to get a "Empty HTTP response message" exception.  It may
 569 david.dillard   1.165         // also mean that the CIM Server is taking longer than 2 seconds
 570                               // (client timeout value) to terminate, causing this client to
 571 kumpf           1.91          // timeout with a "connection timeout" exception.
 572 kumpf           1.45          //
 573 carolann.graves 1.171         //  Wait until either the CIM Server has terminated, or the shutdown
 574                               //  timeout has expired.  If the timeout has expired and the CIM Server
 575                               //  is still running, kill the cimserver process.
 576                               //
 577                               _waitForTerminationOrTimeout (timeoutValue - 2);
 578 kumpf           1.168     }
 579                       
 580 carolann.graves 1.171     //
 581                           //  InvokeMethod succeeded.
 582                           //  Wait until either the CIM Server has terminated, or the shutdown
 583                           //  timeout has expired.  If the timeout has expired and the CIM Server
 584                           //  is still running, kill the cimserver process.
 585                           //
 586                           _waitForTerminationOrTimeout (timeoutValue);
 587 mike            1.35      return;
 588 mike            1.32  }
 589                       
 590 mike            1.35  
 591 mike            1.33  /////////////////////////////////////////////////////////////////////////
 592 mike            1.32  //  MAIN
 593                       //////////////////////////////////////////////////////////////////////////
 594                       int main(int argc, char** argv)
 595                       {
 596 mike            1.35      String pegasusHome  = String::EMPTY;
 597                           Boolean shutdownOption = false;
 598 mday            1.47  
 599 humberto        1.97  //l10n
 600                       // Set Message loading to process locale
 601 david.dillard   1.165 MessageLoader::_useProcessLocale = true;
 602 humberto        1.97  //l10n
 603                       
 604 kv.le           1.140 //l10n
 605                       #if defined(PEGASUS_OS_AIX) && defined(PEGASUS_HAS_MESSAGES)
 606                       setlocale(LC_ALL, "");
 607                       #endif
 608                       
 609 chuck           1.66  #ifdef PEGASUS_OS_OS400
 610 david           1.120 
 611                         VFYPTRS_INCDCL;               // VFYPTRS local variables
 612                       
 613                         // verify pointers
 614                         #pragma exception_handler (qsyvp_excp_hndlr,qsyvp_excp_comm_area,\
 615                           0,_C2_MH_ESCAPE)
 616                           for( int arg_index = 1; arg_index < argc; arg_index++ ){
 617 h.sterling      1.153     VFYPTRS(VERIFY_SPP_NULL(argv[arg_index]));
 618 david           1.120     }
 619                         #pragma disable_handler
 620                       
 621 david           1.100     // Convert the args to ASCII
 622                           for(Uint32 i = 0;i< argc;++i)
 623                           {
 624 h.sterling      1.153     EtoA(argv[i]);
 625 david           1.100     }
 626                       
 627 chuck           1.66      // Initialize Pegasus home to the shipped OS/400 directory.
 628                           pegasusHome = OS400_DEFAULT_PEGASUS_HOME;
 629                       #endif
 630                       
 631 kv.le           1.134 
 632 tony            1.82  #ifndef PEGASUS_OS_TYPE_WINDOWS
 633 kumpf           1.38      //
 634                           // Get environment variables:
 635                           //
 636 david           1.100 #ifdef PEGASUS_OS_OS400
 637                       #pragma convert(37)
 638                           const char* tmp = getenv("PEGASUS_HOME");
 639                       #pragma convert(0)
 640                           char home[256] = {0};
 641                           if (tmp && strlen(tmp) < 256)
 642                           {
 643 h.sterling      1.153     strcpy(home, tmp);
 644                           EtoA(home);
 645                           pegasusHome = home;
 646 david           1.100     }
 647                       #else
 648 kv.le           1.134   #if defined(PEGASUS_OS_AIX) && defined(PEGASUS_USE_RELEASE_DIRS)
 649                           pegasusHome = AIX_RELEASE_PEGASUS_HOME;
 650 marek           1.170   #elif !defined(PEGASUS_USE_RELEASE_DIRS) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
 651 kumpf           1.38      const char* tmp = getenv("PEGASUS_HOME");
 652                       
 653                           if (tmp)
 654                           {
 655                               pegasusHome = tmp;
 656                           }
 657 kv.le           1.134   #endif
 658 david           1.100 #endif
 659 kumpf           1.38  
 660                           FileSystem::translateSlashes(pegasusHome);
 661 tony            1.82  #else
 662 kumpf           1.38  
 663 tony            1.82    // windows only
 664 h.sterling      1.153   //setHome(pegasusHome);
 665                         pegasusHome = _cimServerProcess->getHome();
 666 tony            1.82  #endif
 667 mike            1.32  
 668 kumpf           1.60          // Get help, version, and shutdown options
 669 mike            1.35  
 670                               for (int i = 1; i < argc; )
 671                               {
 672                                   const char* arg = argv[i];
 673 a.arora         1.142             if(String::equal(arg,"--help"))
 674                                   {
 675                                           PrintHelp(argv[0]);
 676                                           exit(0);
 677                                   }
 678                                   else if(String::equal(arg,"--version"))
 679                                   {
 680 h.sterling      1.153                 cout << _cimServerProcess->getVersion() << endl;
 681 a.arora         1.142                 exit(0);
 682                                   }
 683 mike            1.35              // Check for -option
 684 a.arora         1.142             else if (*arg == '-')
 685 mike            1.35              {
 686                                       // Get the option
 687                                       const char* option = arg + 1;
 688                       
 689                                       //
 690                                       // Check to see if user asked for the version (-v option):
 691                                       //
 692 tony            1.83                  if (*option == OPTION_VERSION &&
 693                                           strlen(option) == 1)
 694 mike            1.35                  {
 695 h.sterling      1.153                     cout << _cimServerProcess->getVersion() << endl;
 696 mike            1.35                      exit(0);
 697                                       }
 698                                       //
 699                                       // Check to see if user asked for help (-h option):
 700                                       //
 701 tony            1.83                  else if (*option == OPTION_HELP &&
 702                                               (strlen(option) == 1))
 703 mike            1.35                  {
 704                                           PrintHelp(argv[0]);
 705                                           exit(0);
 706                                       }
 707 kumpf           1.138 #if !defined(PEGASUS_USE_RELEASE_DIRS)
 708 tony            1.83                  else if (*option == OPTION_HOME &&
 709                                               (strlen(option) == 1))
 710 mike            1.35                  {
 711 kumpf           1.60                      if (i + 1 < argc)
 712 mike            1.35                      {
 713                                               pegasusHome.assign(argv[i + 1]);
 714                                           }
 715                                           else
 716                                           {
 717 humberto        1.97                          //l10n
 718                                               //cout << "Missing argument for option -" << option << endl;
 719 humberto        1.99                          String opt(option);
 720 humberto        1.97                          MessageLoaderParms parms("src.Server.cimserver.MISSING_ARGUMENT",
 721 h.sterling      1.153                                          "Missing argument for option -$0",
 722                                                                opt);
 723                                               cout << MessageLoader::getMessage(parms) << endl;
 724 mike            1.35                          exit(0);
 725                                           }
 726                       
 727                                           memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));
 728                                           argc -= 2;
 729                                       }
 730 kumpf           1.63  #endif
 731 kumpf           1.48  #if defined(PEGASUS_OS_HPUX)
 732                                       //
 733 kumpf           1.49                  // Check to see if user asked for the version (-X option):
 734 kumpf           1.48                  //
 735 tony            1.83                  if (*option == OPTION_BINDVERBOSE &&
 736                                               (strlen(option) == 1))
 737 kumpf           1.48                  {
 738 h.sterling      1.153             System::bindVerbose = true;
 739 humberto        1.97                      //l10n
 740 david.dillard   1.165                     //cout << "Unsupported debug option, BIND_VERBOSE, enabled."
 741 humberto        1.97                           //<< endl;
 742                                           MessageLoaderParms parms("src.Server.cimserver.UNSUPPORTED_DEBUG_OPTION",
 743 h.sterling      1.153                                          "Unsupported debug option, BIND_VERBOSE, enabled.");
 744                                           cout << MessageLoader::getMessage(parms) << endl;
 745 kumpf           1.48                      // remove the option from the command line
 746                                           memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
 747 david.dillard   1.165                     argc--;
 748 kumpf           1.48                  }
 749                       #endif
 750 mike            1.35                  //
 751                                       // Check to see if user asked for shutdown (-s option):
 752                                       //
 753 tony            1.82                  else if (*option == OPTION_SHUTDOWN &&
 754                                               (strlen(option) == 1))
 755 mike            1.35                  {
 756                                           //
 757 kumpf           1.52                      // Check to see if shutdown has already been specified:
 758 mike            1.35                      //
 759 kumpf           1.52                      if (shutdownOption)
 760 mike            1.35                      {
 761 humberto        1.97                          //l10n
 762                                               //cout << "Duplicate shutdown option specified." << endl;
 763                                               MessageLoaderParms parms("src.Server.cimserver.DUPLICATE_SHUTDOWN_OPTION",
 764 h.sterling      1.153                                                  "Duplicate shutdown option specified.");
 765 david.dillard   1.165 
 766 humberto        1.97                          cout << MessageLoader::getMessage(parms) << endl;
 767 mike            1.35                          exit(0);
 768                                           }
 769                       
 770 kumpf           1.52                      shutdownOption = true;
 771 david.dillard   1.165 
 772 mike            1.35                      // remove the option from the command line
 773                                           memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
 774 david.dillard   1.165                     argc--;
 775 mike            1.35                  }
 776                                       else
 777                                           i++;
 778                                   }
 779                                   else
 780                                       i++;
 781 mike            1.32          }
 782 mike            1.35  
 783 kumpf           1.38      //
 784                           // Set the value for pegasusHome property
 785                           //
 786                           ConfigManager::setPegasusHome(pegasusHome);
 787 mike            1.32  
 788 mike            1.35      //
 789 carolann.graves 1.171     // Do the platform specific run
 790 s.hills         1.117     //
 791                       
 792 h.sterling      1.153     return _cimServerProcess->platform_run( argc, argv, shutdownOption );
 793 s.hills         1.117 }
 794                       
 795 h.sterling      1.153 void CIMServerProcess::cimserver_stop()
 796                       {
 797                           _cimServer->shutdownSignal();
 798                       }
 799 s.hills         1.117 
 800                       //
 801                       // The main, common, running code
 802                       //
 803 david.dillard   1.165 // NOTE: Do NOT call exit().  Use return(), otherwise some platforms
 804 s.hills         1.117 // will fail to shutdown properly/cleanly.
 805                       //
 806 david.dillard   1.165 // TODO: Current change minimal for platform "service" shutdown bug fixes.
 807 carolann.graves 1.171 // Perhaps further extract out common stuff and put into main(), put
 808 david.dillard   1.165 // daemon stuff into platform specific platform_run(), etc.
 809                       // Note: make sure to not put error handling stuff that platform
 810 carolann.graves 1.171 // specific runs may need to deal with better (instead of exit(), etc).
 811 s.hills         1.117 //
 812                       
 813 h.sterling      1.153 int CIMServerProcess::cimserver_run( int argc, char** argv, Boolean shutdownOption )
 814 s.hills         1.117 {
 815                           String logsDirectory = String::EMPTY;
 816                           Boolean daemonOption = false;
 817                       
 818                           //
 819 mike            1.35      // Get an instance of the Config Manager.
 820                           //
 821                           configManager = ConfigManager::getInstance();
 822 kumpf           1.136     configManager->useConfigFiles = true;
 823 mike            1.35  
 824 lucier          1.130 #ifdef PEGASUS_OS_OS400
 825                           // In a special startup case for IBM OS400, when the server is
 826                           // automatically started when the machine starts up the config
 827                           // file cannot be read because of access restrictions for the
 828                           // user starting the server.  In this case, we need to skip
 829                           // reading the config options and therefore any use of the config
 830                           // manager also.  To make this determinations we will check to see
 831                           // if the daemon flag is set to true.  If so, then there will be a
 832                           // series of checks to bracket all the calls to the configManager
 833                           // which would otherwise fail.  All this will only be done for
 834                           // IBM OS400.
 835                       
 836                           Boolean os400StartupOption = false;
 837                           // loop through args to check for daemon=true
 838                           for (int i=1; i < argc; i++)
 839                             if (strcmp(argv[i], "daemon=true") == 0)
 840                             {
 841                               os400StartupOption = true;
 842                               daemonOption = true;
 843                             }
 844 chuck           1.164 
 845                           if (!os400StartupOption)
 846                           {
 847                               // If this is the server job, then set the job
 848                               // to save the job log.
 849                               system ("QSYS/CHGJOB JOB(*) LOG(4 00 *SECLVL)");
 850                           }
 851 david.dillard   1.165 #endif
 852 lucier          1.130 
 853 mike            1.35      //
 854 mike            1.32      // Get options (from command line and from configuration file); this
 855 mike            1.35      // removes corresponding options and their arguments from the command
 856 mike            1.32      // line.
 857 mike            1.35      //
 858 mike            1.32      try
 859                           {
 860 lucier          1.130 #ifdef PEGASUS_OS_OS400
 861                           if (os400StartupOption == false)
 862 david.dillard   1.165 #endif
 863 s.hills         1.117         GetOptions(configManager, argc, argv);
 864 mike            1.32      }
 865                           catch (Exception& e)
 866                           {
 867 kumpf           1.127         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
 868                                   "src.Server.cimserver.SERVER_NOT_STARTED",
 869                                   "cimserver not started:  $0", e.getMessage());
 870                       
 871                       #if !defined(PEGASUS_OS_OS400)
 872                               MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED",
 873                                   "cimserver not started: $0", e.getMessage());
 874                       
 875                               PEGASUS_STD(cerr) << argv[0] << ": " << MessageLoader::getMessage(parms)
 876                                   << PEGASUS_STD(endl);
 877 david           1.85  #endif
 878 kumpf           1.127 
 879 s.hills         1.117         return(1);
 880 mike            1.32      }
 881                       
 882 chuck           1.94  // l10n
 883 h.sterling      1.153     // Set the home directory, msg sub-dir, into the MessageLoader.
 884 david.dillard   1.165     // This will be the default directory where the resource bundles
 885                           // are found.
 886 h.sterling      1.153     MessageLoader::setPegasusMsgHome(ConfigManager::getHomedPath(
 887 david.dillard   1.165         ConfigManager::getInstance()->getCurrentValue("messageDir")));
 888 chuck           1.94  
 889 lucier          1.130 #ifdef PEGASUS_OS_OS400
 890                           // Still need to declare and set the connection variables.
 891                           // Will initialize to false since they are fixed at false for OS400.
 892                       
 893                           // NOTE:  OS400 is a LOCAL_DOMAIN_SOCKET, so a few lines down
 894                           // the test will not be compiled in.  If OS400 ever turns off that
 895                           // define, then we will need to change this code path to insure that
 896 david.dillard   1.165     // one of the variables is true.
 897 lucier          1.130     Boolean enableHttpConnection = false;
 898                           Boolean enableHttpsConnection = false;
 899 kumpf           1.135     Boolean enableSSLExportClientVerification = false;
 900 lucier          1.130 
 901                           if (os400StartupOption == false)
 902                           {
 903                             enableHttpConnection = String::equal(
 904                                 configManager->getCurrentValue("enableHttpConnection"), "true");
 905                             enableHttpsConnection = String::equal(
 906                                 configManager->getCurrentValue("enableHttpsConnection"), "true");
 907 kumpf           1.135       enableSSLExportClientVerification = String::equal(
 908                                 configManager->getCurrentValue("enableSSLExportClientVerification"), "true");
 909 lucier          1.130     }
 910                       #else
 911 kumpf           1.87      Boolean enableHttpConnection = String::equal(
 912                               configManager->getCurrentValue("enableHttpConnection"), "true");
 913                           Boolean enableHttpsConnection = String::equal(
 914                               configManager->getCurrentValue("enableHttpsConnection"), "true");
 915 kumpf           1.135     Boolean enableSSLExportClientVerification = String::equal(
 916                               configManager->getCurrentValue("enableSSLExportClientVerification"), "true");
 917 lucier          1.130 #endif
 918 kumpf           1.86  
 919                           // Make sure at least one connection is enabled
 920 h.sterling      1.159 #ifdef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
 921 kumpf           1.86      if (!enableHttpConnection && !enableHttpsConnection)
 922                           {
 923 humberto        1.97          //l10n
 924                               //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
 925                                   //"Neither HTTP nor HTTPS connection is enabled.  "
 926                                   //"CIMServer will not be started.");
 927                               Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
 928 h.sterling      1.153             "src.Server.cimserver.HTTP_NOT_ENABLED_SERVER_NOT_STARTING",
 929 humberto        1.97              "Neither HTTP nor HTTPS connection is enabled.  CIMServer will not be started.");
 930                               //cerr << "Neither HTTP nor HTTPS connection is enabled.  "
 931                                   //"CIMServer will not be started." << endl;
 932                               MessageLoaderParms parms("src.Server.cimserver.HTTP_NOT_ENABLED_SERVER_NOT_STARTING",
 933 h.sterling      1.153                                  "Neither HTTP nor HTTPS connection is enabled.  CIMServer will not be started.");
 934 humberto        1.97          cerr << MessageLoader::getMessage(parms) << endl;
 935 s.hills         1.117         return(1);
 936 kumpf           1.86      }
 937                       #endif
 938                       
 939 mike            1.35      try
 940 mike            1.32      {
 941 mike            1.35          //
 942                               // Check to see if we should Pegasus as a daemon
 943                               //
 944                       
 945                               if (String::equal(configManager->getCurrentValue("daemon"), "true"))
 946                               {
 947                                   daemonOption = true;
 948                               }
 949 david.dillard   1.165 
 950 lucier          1.130 #ifdef PEGASUS_OS_OS400
 951                           if (os400StartupOption == false)
 952                           {
 953 david.dillard   1.165 #endif
 954 kumpf           1.36          // Get the log file directory definition.
 955                               // We put String into Cstring because
 956                               // Directory functions only handle Cstring.
 957                               // ATTN-KS: create String based directory functions.
 958 konrad.r        1.161 #if !defined(PEGASUS_USE_SYSLOGS)
 959                       		// When using syslog facility. No files anymore.
 960 kumpf           1.36          logsDirectory = configManager->getCurrentValue("logdir");
 961 david.dillard   1.165         logsDirectory =
 962 h.sterling      1.153         ConfigManager::getHomedPath(configManager->getCurrentValue("logdir"));
 963 konrad.r        1.161 #endif
 964 lucier          1.130 #ifdef PEGASUS_OS_OS400
 965                           }  // end if (os400StartupOption == false)
 966                       #endif
 967 kumpf           1.36  
 968                               // Set up the Logger. This does not open the logs
 969                               // Might be more logical to clean before set.
 970                               // ATTN: Need tool to completely disable logging.
 971                       
 972 david           1.85  #if !defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) && \
 973 konrad.r        1.161 !defined(PEGASUS_OS_OS400) && !defined(PEGASUS_USE_SYSLOGS)
 974 kumpf           1.36          Logger::setHomeDirectory(logsDirectory);
 975 kumpf           1.57  #endif
 976 kumpf           1.36  
 977                               //
 978 david.dillard   1.165         // Check to see if we need to shutdown CIMOM
 979 mike            1.35          //
 980                               if (shutdownOption)
 981                               {
 982 david.dillard   1.165             String configTimeout =
 983 kumpf           1.60                  configManager->getCurrentValue("shutdownTimeout");
 984 s.hills         1.117             Uint32 timeoutValue = strtol(configTimeout.getCString(), (char **)0, 10);
 985 david.dillard   1.165 
 986 kumpf           1.52              shutdownCIMOM(timeoutValue);
 987 kumpf           1.45  
 988 david           1.85  #ifdef PEGASUS_OS_OS400
 989 h.sterling      1.153         //l10n
 990                               //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,
 991 david.dillard   1.165             //"CIM Server stopped.");
 992 h.sterling      1.153         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,
 993                                   "src.Server.cimserver.SERVER_STOPPED",
 994                                   "CIM Server stopped.");
 995 s.hills         1.117             cimserver_exitRC(0);
 996 david           1.85  #else
 997 h.sterling      1.153             //l10n
 998 humberto        1.97              //cout << "CIM Server stopped." << endl;
 999                                   MessageLoaderParms parms("src.Server.cimserver.SERVER_STOPPED",
1000 h.sterling      1.153                                      "CIM Server stopped.");
1001 humberto        1.106 
1002 humberto        1.97              cout << MessageLoader::getMessage(parms) << endl;
1003 s.hills         1.117             return(0);
1004 diane           1.81  #endif
1005 mike            1.35          }
1006 mike            1.32  
1007 kumpf           1.139 #if defined(PEGASUS_DEBUG)
1008 kumpf           1.36          // Leave this in until people get familiar with the logs.
1009 humberto        1.97          //l10n
1010                               //cout << "Logs Directory = " << logsDirectory << endl;
1011 konrad.r        1.161 #if !defined(PEGASUS_USE_SYSLOGS)
1012 humberto        1.97          MessageLoaderParms parms("src.Server.cimserver.LOGS_DIRECTORY",
1013 h.sterling      1.153                                  "Logs Directory = ");
1014 humberto        1.97          cout << MessageLoader::getMessage(parms) << logsDirectory << endl;
1015 kumpf           1.57  #endif
1016 konrad.r        1.161 #endif
1017 mike            1.32      }
1018 kumpf           1.122     catch (UnrecognizedConfigProperty& e)
1019 mike            1.32      {
1020 david           1.85  
1021                       #ifdef PEGASUS_OS_OS400
1022 h.sterling      1.153     //l10n
1023                           //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
1024 david.dillard   1.165             //"Error: $0",e.getMessage());
1025 h.sterling      1.153     Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
1026                                   "src.Server.cimserver.ERROR",
1027 david.dillard   1.165             "Error: $0",e.getMessage());
1028 david           1.85  #else
1029 h.sterling      1.153     //l10n
1030                           //cout << "Error: " << e.getMessage() << endl;
1031                           MessageLoaderParms parms("src.Server.cimserver.ERROR",
1032                                                    "Error: $0",
1033                                                    e.getMessage());
1034                           cout << MessageLoader::getMessage(parms) << endl;
1035 david           1.85  #endif
1036 mike            1.32      }
1037                       
1038 h.sterling      1.158     // Bug 2148 - Here is the order of operations for determining the server HTTP and HTTPS ports.
1039                           // 1) If the user explicitly specified a port, use it.
1040                           // 2) If the user did not specify a port, get the port from the services file.
1041                           // 3) If no value is specified in the services file, use the IANA WBEM default port.
1042                           // Note that 2 and 3 are done within the System::lookupPort method
1043                           // An empty string from the ConfigManager implies that the user did not specify a port.
1044                       
1045 w.otsuka        1.147     Uint32 portNumberHttps=0;
1046                           Uint32 portNumberHttp=0;
1047                           Uint32 portNumberExportHttps=0;
1048 kumpf           1.53  
1049 kumpf           1.86      if (enableHttpsConnection)
1050 kumpf           1.53      {
1051 kumpf           1.86          String httpsPort = configManager->getCurrentValue("httpsPort");
1052 h.sterling      1.158         if (httpsPort == String::EMPTY)
1053 joyce.j         1.144         {
1054 h.sterling      1.158             //
1055                                   // Look up the WBEM-HTTPS port number
1056                                   //
1057                                   portNumberHttps = System::lookupPort(WBEM_HTTPS_SERVICE_NAME, WBEM_DEFAULT_HTTPS_PORT);
1058                       
1059                               } else
1060 david.dillard   1.165         {
1061 h.sterling      1.158             //
1062                                   // user-specified
1063                                   //
1064                                   CString portString = httpsPort.getCString();
1065                                   char* end = 0;
1066                                   portNumberHttps = strtol(portString, &end, 10);
1067                                   if(!(end != 0 && *end == '\0'))
1068                                   {
1069 joyce.j         1.160                 InvalidPropertyValue e("httpsPort", httpsPort);
1070 aruran.ms       1.173                 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
1071                                                     "src.Server.cimserver.SERVER_NOT_STARTED",
1072                                                     "cimserver not started:  $0", e.getMessage());
1073                       #if !defined(PEGASUS_OS_OS400)
1074                                       MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED",
1075                                                                "cimserver not started: $0", e.getMessage());
1076                                       PEGASUS_STD(cerr) << argv[0] << ": " << MessageLoader::getMessage(parms)
1077                                                         << PEGASUS_STD(endl);
1078                       #endif
1079 h.sterling      1.158                 exit(1);
1080                                   }
1081 joyce.j         1.144         }
1082 kumpf           1.53      }
1083 kumpf           1.86  
1084                           if (enableHttpConnection)
1085 kumpf           1.53      {
1086 kumpf           1.86          String httpPort = configManager->getCurrentValue("httpPort");
1087 h.sterling      1.158         if (httpPort == String::EMPTY)
1088 joyce.j         1.144         {
1089 h.sterling      1.158             //
1090                                   // Look up the WBEM-HTTP port number
1091                                   //
1092                                   portNumberHttp = System::lookupPort(WBEM_HTTP_SERVICE_NAME, WBEM_DEFAULT_HTTP_PORT);
1093                       
1094                               } else
1095                               {
1096                                   //
1097                                   // user-specified
1098                                   //
1099                                   CString portString = httpPort.getCString();
1100                                   char* end = 0;
1101                                   portNumberHttp = strtol(portString, &end, 10);
1102                                   if(!(end != 0 && *end == '\0'))
1103                                   {
1104 joyce.j         1.160                 InvalidPropertyValue e("httpPort", httpPort);
1105 aruran.ms       1.173                 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
1106                                                     "src.Server.cimserver.SERVER_NOT_STARTED",
1107                                                     "cimserver not started:  $0", e.getMessage());
1108                       #if !defined(PEGASUS_OS_OS400)
1109                                       MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED",
1110                                                                    "cimserver not started: $0", e.getMessage());
1111                                       PEGASUS_STD(cerr) << argv[0] << ": " << MessageLoader::getMessage(parms)
1112                                                         << PEGASUS_STD(endl);
1113                       #endif
1114 h.sterling      1.158                 exit(1);
1115                                   }
1116 joyce.j         1.144         }
1117 kumpf           1.53      }
1118 mike            1.32  
1119 h.sterling      1.158 
1120 kumpf           1.135     if (enableSSLExportClientVerification)
1121                           {
1122                               //
1123                               // No config property is looked up to get the default port number.
1124                               // Lookup the port defined in /etc/services for the service name
1125                               // wbem-exp-https and bind to that port. If the service is  not defined
1126                               // then log a warning message and do not start the cimserver.
1127                               //
1128                               Uint32 port = 0;
1129                       
1130                               portNumberExportHttps = System::lookupPort(WBEM_EXPORT_HTTPS_SERVICE_NAME, port);
1131                       
1132                               if (portNumberExportHttps == 0)
1133                               {
1134                                   Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
1135                                       "src.Server.cimserver.EXPORT_HTTPS_PORT_NOT_DEFINED",
1136                                       "Port not defined for the service wbem-exp-https. CIMServer will not be started.");
1137                       
1138                                   MessageLoaderParms parms("src.Server.cimserver.EXPORT_HTTPS_PORT_NOT_DEFINED",
1139                                       "Port not defined for the service wbem-exp-https. CIMServer will not be started.");
1140                       
1141 kumpf           1.135             cerr << MessageLoader::getMessage(parms) << endl;
1142                       
1143                                   return(1);
1144                               }
1145                           }
1146 kumpf           1.139 #if defined(PEGASUS_DEBUG)
1147 mike            1.32      // Put out startup up message.
1148 h.sterling      1.153     cout << _cimServerProcess->getProductName() << " " << _cimServerProcess->getVersion() << endl;
1149 humberto        1.97      //l10n
1150                           //cout << "Built " << __DATE__ << " " << __TIME__ << endl;
1151                           //cout <<"Starting..."
1152                           MessageLoaderParms parms("src.Server.cimserver.STARTUP_MESSAGE",
1153 h.sterling      1.153                              "Built $0 $1\nStarting...",
1154                                                    __DATE__,
1155                                                    __TIME__);
1156 humberto        1.97  #endif
1157                       
1158                       //l10n
1159                       // reset message loading to NON-process locale
1160 david.dillard   1.165 MessageLoader::_useProcessLocale = false;
1161 humberto        1.97  //l10n
1162 mike            1.32  
1163 kumpf           1.137     // Get the parent's PID before forking
1164 h.sterling      1.154     _cimServerProcess->set_parent_pid(System::getPID());
1165 david.dillard   1.165 
1166 kumpf           1.63      // do we need to run as a daemon ?
1167                           if (daemonOption)
1168                           {
1169 h.sterling      1.153         if(-1 == _cimServerProcess->cimserver_fork())
1170 diane           1.81  #ifndef PEGASUS_OS_OS400
1171 h.sterling      1.153     {
1172                               return(-1);
1173                           }
1174 diane           1.81  #else
1175 h.sterling      1.153     {
1176 david           1.85              return(-1);
1177 h.sterling      1.153     }
1178                           else
1179                           {
1180                               return(0);
1181                           }
1182 diane           1.81  #endif
1183 david.dillard   1.165 
1184 kumpf           1.63      }
1185 chuck           1.66  
1186 chuck           1.96  // l10n
1187                           // Now we are after the fork...
1188                           // Create a dummy Thread object that can be used to store the
1189                           // AcceptLanguages object for CIM requests that are serviced
1190                           // by this thread (initial thread of server).  Need to do this
1191                           // because this thread is not in a ThreadPool, but is used
1192                           // to service CIM requests.
1193                           // The run function for the dummy Thread should never be called,
1194 konrad.r        1.166     dummyInitialThread = new Thread(dummyThreadFunc, NULL, false);
1195 david.dillard   1.165     Thread::setCurrent(dummyInitialThread);
1196 humberto        1.108     AcceptLanguages default_al;
1197                           try{
1198 kumpf           1.174          default_al = LanguageParser::getDefaultAcceptLanguages();
1199 h.sterling      1.153          Thread::setLanguages(new AcceptLanguages(default_al));
1200 kumpf           1.122     }catch(InvalidAcceptLanguageHeader& e){
1201 h.sterling      1.153           Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
1202                                         "src.Server.cimserver.FAILED_TO_SET_PROCESS_LOCALE",
1203 david.dillard   1.165                   "Could not convert the system process locale into a valid AcceptLanguage format.");
1204 h.sterling      1.153           Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
1205 david.dillard   1.165                              e.getMessage());
1206 humberto        1.108     }
1207 david.dillard   1.165 
1208                       
1209 chuck           1.96  
1210 chuck           1.66  #ifdef PEGASUS_OS_OS400
1211                           // Special server initialization code for OS/400.
1212                           if (cimserver_initialize() != 0)
1213                           {
1214 h.sterling      1.153     // do some logging here!
1215                           //l10n
1216                           //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
1217 david.dillard   1.165             //"CIM Server failed to initialize");
1218 h.sterling      1.153     Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
1219                                         "src.Server.cimserver.SERVER_FAILED_TO_INITIALIZE",
1220 david.dillard   1.165                   "CIM Server failed to initialize");
1221 h.sterling      1.153     return(-1);
1222 david.dillard   1.165     }
1223 chuck           1.66  #endif
1224 chuck           1.96  
1225 kumpf           1.167 #ifndef PEGASUS_OS_TYPE_WINDOWS
1226                           umask(S_IRWXG|S_IRWXO);
1227                       #endif
1228 mday            1.62  
1229 gs.keenan       1.150 #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) \
1230                       || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) \
1231 jim.wunderlich  1.169 || defined(PEGASUS_OS_SOLARIS) || defined (PEGASUS_OS_VMS)
1232 kumpf           1.79  
1233                           //
1234                           // check if CIMServer is already running
1235 david.dillard   1.165     // if CIMServer is already running, print message and
1236 kumpf           1.79      // notify parent process (if there is a parent process) to terminate
1237                           //
1238 h.sterling      1.153     if(_cimServerProcess->isCIMServerRunning())
1239 kumpf           1.79      {
1240 h.sterling      1.153     //l10n
1241                               //cout << "Unable to start CIMServer." << endl;
1242                               //cout << "CIMServer is already running." << endl;
1243                               MessageLoaderParms parms("src.Server.cimserver.UNABLE_TO_START_SERVER_ALREADY_RUNNING",
1244                                            "Unable to start CIMServer.\nCIMServer is already running.");
1245                           PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);
1246 kumpf           1.79  
1247 h.sterling      1.153     //
1248 kumpf           1.79          // notify parent process (if there is a parent process) to terminate
1249                               //
1250                               if (daemonOption)
1251 h.sterling      1.153                 _cimServerProcess->notify_parent(1);
1252 kumpf           1.79  
1253 s.hills         1.117         return(1);
1254 kumpf           1.79      }
1255 david.dillard   1.165 
1256 kumpf           1.63  #endif
1257 kumpf           1.51  
1258 mike            1.32      // try loop to bind the address, and run the server
1259                           try
1260                           {
1261 mday            1.116 
1262 konrad.r        1.163     _monitor  = new Monitor();
1263 h.sterling      1.153     //PEP#222
1264                           //CIMServer server(&monitor);
1265                           //CimserverHolder cimserverHolder( &server );
1266 konrad.r        1.163     _cimServer = new CIMServer(_monitor);
1267 mday            1.111 
1268 kumpf           1.41  
1269 kumpf           1.86          if (enableHttpConnection)
1270                               {
1271 h.sterling      1.153             _cimServer->addAcceptor(false, portNumberHttp, false, false);
1272 humberto        1.97              //l10n
1273                                   //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
1274                                               //"Listening on HTTP port $0.", portNumberHttp);
1275 david.dillard   1.165 
1276 humberto        1.97              Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
1277 h.sterling      1.153                             "src.Server.cimserver.LISTENING_ON_HTTP_PORT",
1278                                                   "Listening on HTTP port $0.", portNumberHttp);
1279 kumpf           1.86          }
1280                               if (enableHttpsConnection)
1281                               {
1282 h.sterling      1.153             _cimServer->addAcceptor(false, portNumberHttps, true, false);
1283 humberto        1.97              //l10n
1284                                   //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
1285                                               //"Listening on HTTPS port $0.", portNumberHttps);
1286                                   Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
1287 h.sterling      1.153                             "src.Server.cimserver.LISTENING_ON_HTTPS_PORT",
1288                                                   "Listening on HTTPS port $0.", portNumberHttps);
1289 kumpf           1.86          }
1290 kumpf           1.135         if (enableSSLExportClientVerification)
1291                               {
1292 h.sterling      1.153             _cimServer->addAcceptor(false, portNumberExportHttps, true, true);
1293 kumpf           1.135 
1294                                   Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
1295                                       "src.Server.cimserver.LISTENING_ON_EXPORT_HTTPS_PORT",
1296                                       "Listening on Export HTTPS port $0.", portNumberExportHttps);
1297                               }
1298                       
1299 h.sterling      1.159 #ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
1300 h.sterling      1.153         _cimServer->addAcceptor(true, 0, false, false);
1301 humberto        1.97          //l10n
1302                               //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
1303                                           //"Listening on local connection socket.");
1304                               Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
1305 h.sterling      1.153               "src.Server.cimserver.LISTENING_ON_LOCAL",
1306                                     "Listening on local connection socket.");
1307 kumpf           1.41  #endif
1308 kumpf           1.86  
1309 kumpf           1.139 #if defined(PEGASUS_DEBUG)
1310 kumpf           1.86          if (enableHttpConnection)
1311                               {
1312 humberto        1.97              //l10n
1313                                   //cout << "Listening on HTTP port " << portNumberHttp << endl;
1314 h.sterling      1.153       MessageLoaderParms parms("src.Server.cimserver.LISTENING_ON_HTTP_PORT",
1315                                          "Listening on HTTP port $0.", portNumberHttp);
1316                                   cout << MessageLoader::getMessage(parms) << endl;
1317 kumpf           1.86          }
1318                               if (enableHttpsConnection)
1319                               {
1320 humberto        1.97              //l10n
1321                                   //cout << "Listening on HTTPS port " << portNumberHttps << endl;
1322 humberto        1.103             MessageLoaderParms parms("src.Server.cimserver.LISTENING_ON_HTTPS_PORT",
1323 h.sterling      1.153                      "Listening on HTTPS port $0.", portNumberHttps);
1324                                   cout << MessageLoader::getMessage(parms) << endl;
1325 kumpf           1.86          }
1326 kumpf           1.135         if (enableSSLExportClientVerification)
1327                               {
1328                                   MessageLoaderParms parms("src.Server.cimserver.LISTENING_ON_EXPORT_HTTPS_PORT",
1329                                       "Listening on Export HTTPS port $0.", portNumberExportHttps);
1330                       
1331                                   cout << MessageLoader::getMessage(parms) << endl;
1332                               }
1333                       
1334 h.sterling      1.159 # ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
1335 humberto        1.97          //l10n
1336                               //cout << "Listening on local connection socket" << endl;
1337                               MessageLoaderParms parms("src.Server.cimserver.LISTENING_ON_LOCAL",
1338 h.sterling      1.153                  "Listening on local connection socket.");
1339 humberto        1.97          cout << MessageLoader::getMessage(parms) << endl;
1340 kumpf           1.86  # endif
1341 david           1.85  #endif
1342 mike            1.35  
1343 kumpf           1.86          // bind throws an exception if the bind fails
1344 david.dillard   1.165 	try {
1345 konrad.r        1.163            _cimServer->bind();
1346                       	} catch (const BindFailedException &e)
1347                       	{
1348                       #ifdef PEGASUS_DEBUG
1349                               MessageLoaderParms parms("src.Server.cimserver.BIND_FAILED",
1350                                        "Could not bind: $0.", e.getMessage());
1351                               cout << MessageLoader::getMessage(parms) << endl;
1352                       #endif
1353                               Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
1354                                   "src.Server.cimserver.BIND.FAILED",
1355                                   "Could not bind:  $0", e.getMessage());
1356 kumpf           1.73  
1357 konrad.r        1.163 	   deleteCIMServer();
1358                       	   return 1;
1359                       	}
1360 david.dillard   1.165     // notify parent process (if there is a parent process) to terminate
1361 konrad.r        1.95          // so user knows that there is cimserver ready to serve CIM requests.
1362 h.sterling      1.153     if (daemonOption)
1363                               _cimServerProcess->notify_parent(0);
1364 mike            1.32  
1365 h.sterling      1.153     time_t last = 0;
1366 mike            1.35  
1367 gs.keenan       1.150 #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) \
1368 jim.wunderlich  1.169     || defined(PEGASUS_OS_AIX) || defined(PEGASUS_OS_SOLARIS) \
1369 gs.keenan       1.150     || defined(PEGASUS_OS_VMS)
1370 kumpf           1.45          //
1371 kumpf           1.56          // create a file to indicate that the cimserver has started and
1372                               // save the process id of the cimserver process in the file
1373 kumpf           1.45          //
1374 kumpf           1.56          // remove the old file if it exists
1375 h.sterling      1.153         System::removeFile(_cimServerProcess->getPIDFileName());
1376 kumpf           1.56  
1377                               // open the file
1378 h.sterling      1.153         FILE *pid_file = fopen(_cimServerProcess->getPIDFileName(), "w");
1379 kumpf           1.91  
1380 kumpf           1.56          if (pid_file)
1381 kumpf           1.45          {
1382 kumpf           1.56              // save the pid in the file
1383 h.sterling      1.153             fprintf(pid_file, "%ld\n", _cimServerProcess->get_server_pid());
1384 kumpf           1.56              fclose(pid_file);
1385 kumpf           1.45          }
1386                       #endif
1387 kumpf           1.91  
1388 kumpf           1.139 #if defined(PEGASUS_DEBUG)
1389 h.sterling      1.153     cout << "Started. " << endl;
1390 kumpf           1.63  #endif
1391 david.dillard   1.165 
1392 kumpf           1.54          // Put server started message to the logger
1393 kumpf           1.143         Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER,
1394                                   Logger::INFORMATION,
1395                                   "src.Server.cimserver.STARTED_VERSION",
1396                                   "Started $0 version $1.",
1397 h.sterling      1.153             _cimServerProcess->getProductName(), _cimServerProcess->getVersion());
1398 kumpf           1.45  
1399 mike            1.35          //
1400                               // Loop to call CIMServer's runForever() method until CIMServer
1401                               // has been shutdown
1402                               //
1403 h.sterling      1.153     while( !_cimServer->terminated() )
1404                           {
1405 mday            1.116 
1406 h.sterling      1.153       _cimServer->runForever();
1407 mday            1.112 
1408 h.sterling      1.153     }
1409 carson.hovey    1.157 
1410 kumpf           1.45          //
1411                               // normal termination
1412 carson.hovey    1.157         //
1413 kumpf           1.143 
1414 kumpf           1.54          // Put server shutdown message to the logger
1415 kumpf           1.143         Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER,
1416                                   Logger::INFORMATION, "src.Server.cimserver.STOPPED",
1417 h.sterling      1.153             "$0 stopped.", _cimServerProcess->getProductName());
1418 kumpf           1.45  
1419 carolann.graves 1.171 #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) \
1420 gs.keenan       1.150 || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) \
1421 jim.wunderlich  1.169 || defined(PEGASUS_OS_SOLARIS) || defined(PEGASUS_OS_VMS)
1422 kumpf           1.45          //
1423 carolann.graves 1.171         //  Note: do not remove the PID file created at startup time, since
1424                               //  shutdown is not complete until the CIMServer destructor completes.
1425 kumpf           1.45          //
1426                       #endif
1427 mike            1.32      }
1428                           catch(Exception& e)
1429                           {
1430 david           1.100 
1431 h.sterling      1.153     //l10n
1432                           //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
1433 david.dillard   1.165             //"Error: $0", e.getMessage());
1434 h.sterling      1.153     Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
1435                                   "src.Server.cimserver.ERROR",
1436 david.dillard   1.165             "Error: $0", e.getMessage());
1437 konrad.r        1.95  
1438                       #ifndef PEGASUS_OS_OS400
1439 h.sterling      1.153     //l10n
1440                           //PEGASUS_STD(cerr) << "Error: " << e.getMessage() << PEGASUS_STD(endl);
1441                           MessageLoaderParms parms("src.Server.cimserver.ERROR",
1442                                                    "Error: $0", e.getMessage());
1443                           PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);
1444 david           1.100 
1445 david           1.85  #endif
1446 kumpf           1.77  
1447 h.sterling      1.153     //
1448 kumpf           1.77          // notify parent process (if there is a parent process) to terminate
1449                               //
1450                               if (daemonOption)
1451 h.sterling      1.153                 _cimServerProcess->notify_parent(1);
1452 kumpf           1.77  
1453 h.sterling      1.156         deleteCIMServer();
1454 kumpf           1.54          return 1;
1455 mike            1.32      }
1456                       
1457 h.sterling      1.156     deleteCIMServer();
1458 mike            1.32      return 0;
1459                       }
1460 tony            1.128 
1461                       
1462                       
1463                       

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2