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

Diff for /pegasus/src/Server/cimserver.cpp between version 1.53 and 1.54

version 1.53, 2002/05/21 19:08:44 version 1.54, 2002/05/28 18:47:11
Line 47 
Line 47 
 // //
 // To shutdown pegasus, use the -s option: // To shutdown pegasus, use the -s option:
 // //
 // cimserver -s [-T timeout_value]  // cimserver -s [-t timeout_value]
 // //
 // To run pegasus as an NT service, there are FOUR  different possibilities: // To run pegasus as an NT service, there are FOUR  different possibilities:
 // //
Line 131 
Line 131 
  
 static const char OPTION_FORCE       = 'f'; static const char OPTION_FORCE       = 'f';
  
 static const char OPTION_TIMEOUT     = 'T';  static const char OPTION_TIMEOUT     = 't';
  
 #if defined(PEGASUS_OS_HPUX) #if defined(PEGASUS_OS_HPUX)
 static const char OPTION_BINDVERBOSE = 'X'; static const char OPTION_BINDVERBOSE = 'X';
Line 139 
Line 139 
  
 static const String NAMESPACE = "root/PG_Internal"; static const String NAMESPACE = "root/PG_Internal";
 static const String CLASSNAME_SHUTDOWNSERVICE = "PG_ShutdownService"; static const String CLASSNAME_SHUTDOWNSERVICE = "PG_ShutdownService";
 static const String PROPERTY_TIMEOUT = "operationTimeout";  static const String PROPERTY_TIMEOUT = "shutdownTimeout";
 static const String CIMSERVERSTART_FILE = "/etc/wbem/cimserver_start.conf"; static const String CIMSERVERSTART_FILE = "/etc/wbem/cimserver_start.conf";
  
 ConfigManager*    configManager; ConfigManager*    configManager;
Line 201 
Line 201 
     usage.append ("    -v          - displays pegasus version number\n");     usage.append ("    -v          - displays pegasus version number\n");
     usage.append ("    -h          - prints this help message\n");     usage.append ("    -h          - prints this help message\n");
     usage.append ("    -D [home]   - sets pegasus home directory\n");     usage.append ("    -D [home]   - sets pegasus home directory\n");
     usage.append ("    -t          - turns tracing on\n");  
     usage.append ("    -t          - turns on trace of client IO to console\n");  
     usage.append ("    -l          - turns on trace of client IO to trace file\n");  
     usage.append ("    -d          - runs pegasus as a daemon\n");     usage.append ("    -d          - runs pegasus as a daemon\n");
     usage.append ("    -s [-T timeout] \n");      usage.append ("    -s [-t timeout] \n");
     usage.append ("                - shuts down pegasus\n");     usage.append ("                - shuts down pegasus\n");
   #if !defined(PEGASUS_OS_HPUX)
     usage.append ("    -cleanlogs  - clears the log files at startup\n");     usage.append ("    -cleanlogs  - clears the log files at startup\n");
     usage.append ("    -install    - installs pegasus as a Windows NT Service\n");     usage.append ("    -install    - installs pegasus as a Windows NT Service\n");
     usage.append ("    -remove     - removes pegasus as a Windows NT Service\n");     usage.append ("    -remove     - removes pegasus as a Windows NT Service\n");
     usage.append ("    -slp        - registers pegasus as a service with SLP\n\n");     usage.append ("    -slp        - registers pegasus as a service with SLP\n\n");
     usage.append ("    -SSL        - uses SSL\n\n");     usage.append ("    -SSL        - uses SSL\n\n");
   #endif
     usage.append ("  configProperty=value\n");     usage.append ("  configProperty=value\n");
     usage.append ("    port=nnnn            - sets port number to listen on\n");     usage.append ("    port=nnnn            - sets port number to listen on\n");
     usage.append ("    logdir=/pegasus/logs - directory for log files\n");     usage.append ("    logdir=/pegasus/logs - directory for log files\n");
Line 235 
Line 233 
     //     //
     String hostStr = System::getHostName();     String hostStr = System::getHostName();
  
     // Put server shutdown message to the logger  
     Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,  
         "Shutdown $0.", PEGASUS_NAME);  
   
     //     //
     // open connection to CIMOM     // open connection to CIMOM
     //     //
Line 247 
Line 241 
         client.connectLocal();         client.connectLocal();
  
         //         //
         // set client timeout to 10 seconds more than the shutdown timeout          // set client timeout to 2 seconds more than the shutdown timeout
         // so that the command client does not timeout before the cimserver         // so that the command client does not timeout before the cimserver
         // terminates         // terminates
         //         //
         client.setTimeOut( (timeoutValue + 10)*1000 );          Uint32 clientTimeout;
           if (timeoutValue == 0)
           {
               String configTimeout =
                   configManager->getCurrentValue("shutdownTimeout");
              ArrayDestroyer<char> timeoutCString(configTimeout.allocateCString());
               clientTimeout =
                   ((strtol(timeoutCString.getPointer(), (char **)0,10))+2)*1000;
     }     }
     catch(CIMClientException& e)          else
     {     {
         Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,              clientTimeout = (timeoutValue + 2)*1000;
             "Failed to connect to $0 $1.", PEGASUS_NAME, e.getMessage());          }
  
           client.setTimeOut(clientTimeout);
       }
       catch(CIMClientException& e)
       {
         PEGASUS_STD(cerr) << "Unable to connect to CIM Server." << PEGASUS_STD(endl);         PEGASUS_STD(cerr) << "Unable to connect to CIM Server." << PEGASUS_STD(endl);
         PEGASUS_STD(cerr) << "CIM Server may not be running." << PEGASUS_STD(endl);         PEGASUS_STD(cerr) << "CIM Server may not be running." << PEGASUS_STD(endl);
         //PEGASUS_STD(cerr) << e.getMessage() << PEGASUS_STD(endl);  
         exit(0);         exit(0);
     }     }
  
Line 295 
Line 299 
             "shutdown",             "shutdown",
             inParams,             inParams,
             outParams);             outParams);
   
         // Put server shutdown message to the logger  
         Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,  
             "$0 terminated.", PEGASUS_NAME);  
   
     }     }
     catch(CIMClientCIMException& e)     catch(CIMClientCIMException& e)
     {     {
Line 310 
Line 309 
     catch(CIMClientException& e)     catch(CIMClientException& e)
     {     {
         //         //
         // This may mean the cimserver has been terminated and returns the          // This may mean the CIM Server has been terminated and returns a
         // "Empty HTTP response message" HTTP error response.  To be sure,          // "Empty HTTP response message" HTTP error response.  To be sure
         // we need to check if cimserver is indeed terminated.          // CIM Server gets shutdown, if CIM Server is still running at
           // this time, we will kill the cimserver process.
         //         //
 #ifdef PEGASUS_OS_TYPE_UNIX  
   #if defined(PEGASUS_OS_HPUX)
   
           // give cimom some time to finish up
         System::sleep(1);         System::sleep(1);
         int ret = system("ps -ef | grep cimserver | grep -v grep | grep -v cimserverd >/dev/null");  
         if (ret == 0)          // add code to kill cimom if it is still running
         {  
             // cimserver has been terminated  
             // Put server shutdown message to the logger  
             Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,  
                 "$0 terminated.", PEGASUS_NAME);  
         }  
         else  
         {  
             // cimserver is still running  
             PEGASUS_STD(cerr) << "Failed to shutdown server: ";  
             PEGASUS_STD(cerr) << e.getMessage() << PEGASUS_STD(endl);  
             exit(1);  
         }  
 #endif #endif
     }     }
     catch(Exception& e)     catch(Exception& e)
Line 350 
Line 341 
 int main(int argc, char** argv) int main(int argc, char** argv)
 { {
     String pegasusHome  = String::EMPTY;     String pegasusHome  = String::EMPTY;
     Boolean pegasusIOTrace = false;  
     Boolean pegasusIOLog = false;     Boolean pegasusIOLog = false;
     String httpPort = String::EMPTY;     String httpPort = String::EMPTY;
     String httpsPort = String::EMPTY;     String httpsPort = String::EMPTY;
Line 637 
Line 627 
  
             shutdownCIMOM(timeoutValue);             shutdownCIMOM(timeoutValue);
  
             cout << "Pegasus CIM Server terminated." << endl;              cout << "Pegasus CIM Server stopped." << endl;
             exit(0);             exit(0);
         }         }
  
Line 649 
Line 639 
  
         httpsPort = configManager->getCurrentValue("httpsPort");         httpsPort = configManager->getCurrentValue("httpsPort");
  
         //  
         // Check the trace options and set global variable  
         //  
   
         if (String::equal(configManager->getCurrentValue("trace"), "true"))  
         {  
             pegasusIOTrace = true;  
             cout << "Trace Set" << endl;  
         }  
   
         // Leave this in until people get familiar with the logs.         // Leave this in until people get familiar with the logs.
         cout << "Logs Directory = " << logsDirectory << endl;         cout << "Logs Directory = " << logsDirectory << endl;
  
Line 719 
Line 699 
     cout << PEGASUS_NAME << PEGASUS_VERSION <<     cout << PEGASUS_NAME << PEGASUS_VERSION <<
          " on port " << address << endl;          " on port " << address << endl;
     cout << "Built " << __DATE__ << " " << __TIME__ << endl;     cout << "Built " << __DATE__ << " " << __TIME__ << endl;
     cout <<"Started..."      cout <<"Starting..."
          << (pegasusIOTrace ? " Tracing to Display ": " ")  
          << (pegasusIOLog ? " Tracing to Log ": " ")          << (pegasusIOLog ? " Tracing to Log ": " ")
          << (useSLP ? " SLP reg. " : " No SLP ")          << (useSLP ? " SLP reg. " : " No SLP ")
          << (useSSL ? " Use SSL " : " No SSL ")          << (useSSL ? " Use SSL " : " No SSL ")
Line 733 
Line 712 
           exit(-1);           exit(-1);
     }     }
  
     // Put server start message to the logger      // Put server starting message to the logger
     Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,     Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
         "Start $0 $1 port $2 $3 $4 $5",          "Starting $0 version $1 on port $2 $3 $4 $5",
                 PEGASUS_NAME,                 PEGASUS_NAME,
                 PEGASUS_VERSION,                 PEGASUS_VERSION,
                 address,                 address,
                 (pegasusIOTrace ? " Tracing": " "),  
                 (useSLP ? " SLP on " : " SLP off "),                 (useSLP ? " SLP on " : " SLP off "),
                 (useSSL ? " Use SSL " : " No SSL "));                 (useSSL ? " Use SSL " : " No SSL "));
  
Line 785 
Line 763 
             // failed to create the file, write an entry to the log file             // failed to create the file, write an entry to the log file
             // and proceed             // and proceed
             //             //
             Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,              //Logger::put(Logger::STANDARD_LOG, "CIMServer",
                 "Failed to open the $0 file needed by cimserverd.",              //    Logger::INFORMATION,
                 CIMSERVERSTART_FILE);              //    "Failed to open the $0 file needed by cimserverd.",
               //    CIMSERVERSTART_FILE);
         }         }
         else         else
         {         {
             fs.close();             fs.close();
         }         }
 #endif #endif
           cout << "Started. " << endl;
   
           // Put server started message to the logger
           Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
               "$0 started.", PEGASUS_NAME);
  
         //         //
         // Loop to call CIMServer's runForever() method until CIMServer         // Loop to call CIMServer's runForever() method until CIMServer
Line 824 
Line 808 
         //         //
         // normal termination         // normal termination
         //         //
           // Put server shutdown message to the logger
         Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,         Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
             "Normal Termination");              "$0 stopped.", PEGASUS_NAME);
  
 #if defined(PEGASUS_OS_HPUX) #if defined(PEGASUS_OS_HPUX)
         //         //
Line 838 
Line 823 
     catch(Exception& e)     catch(Exception& e)
     {     {
         Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,         Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
             "Abnormal Termination $0", e.getMessage());              "$0 Abnormal Termination.", e.getMessage());
  
         PEGASUS_STD(cerr) << "Error: " << e.getMessage() << PEGASUS_STD(endl);         PEGASUS_STD(cerr) << "Error: " << e.getMessage() << PEGASUS_STD(endl);
           return 1;
     }     }
  
     return 0;     return 0;


Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2