(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.59 and 1.60

version 1.59, 2002/06/03 17:49:52 version 1.60, 2002/06/04 01:42:38
Line 40 
Line 40 
 // //
 // Notes on deamon operation (Unix) and service operation (Win 32): // Notes on deamon operation (Unix) and service operation (Win 32):
 // //
 // To run pegasus as a daemon on Unix platforms, use the -d option:  // To run pegasus as a daemon on Unix platforms:
 // //
 // cimserver -d  // cimserver
 // //
 // The -d option has no effect on windows operation.  // To NOT run pegasus as a daemon on Unix platforms, set the daemon config
   // property to false:
   //
   // cimserver daemon=false
   //
   // The daemon config property has no effect on windows operation.
 // //
 // To shutdown pegasus, use the -s option: // To shutdown pegasus, use the -s option:
 // //
 // cimserver -s [-t timeout_value]  // cimserver -s
 // //
 // 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 136 
  
 static const char OPTION_SHUTDOWN    = 's'; static const char OPTION_SHUTDOWN    = 's';
  
 static const char OPTION_FORCE       = 'f';  
   
 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';
 #endif #endif
Line 198 
Line 199 
     usage.append (COMMAND_NAME);     usage.append (COMMAND_NAME);
     usage.append (" [ [ options ] | [ configProperty=value, ... ] ]\n");     usage.append (" [ [ options ] | [ configProperty=value, ... ] ]\n");
     usage.append ("  options\n");     usage.append ("  options\n");
     usage.append ("    -v          - displays pegasus version number\n");      usage.append ("    -v          - displays CIM Server version number\n");
     usage.append ("    -h          - prints this help message\n");     usage.append ("    -h          - prints this help message\n");
       usage.append ("    -s          - shuts down CIM Server\n");
   #ifndef PEGASUS_OS_HPUX
     usage.append ("    -D [home]   - sets pegasus home directory\n");     usage.append ("    -D [home]   - sets pegasus home directory\n");
     usage.append ("    -d          - runs pegasus as a daemon\n");  #endif
     usage.append ("    -s [-t timeout] \n");  #if defined(PEGASUS_OS_TYPE_WINDOWS)
     usage.append ("                - shuts down pegasus\n");  
 #if !defined(PEGASUS_OS_HPUX)  
     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 ("    -SSL        - uses SSL\n\n");  
 #endif #endif
     usage.append ("  configProperty=value\n");     usage.append ("  configProperty=value\n");
     usage.append ("    port=nnnn            - sets port number to listen on\n");      usage.append ("                - sets CIM Server configuration property\n");
     usage.append ("    logdir=/pegasus/logs - directory for log files\n");  
  
     cout << endl;     cout << endl;
     cout << PEGASUS_NAME << PEGASUS_VERSION << endl;     cout << PEGASUS_NAME << PEGASUS_VERSION << endl;
Line 245 
Line 242 
         // so that the command client does not timeout before the cimserver         // so that the command client does not timeout before the cimserver
         // terminates         // terminates
         //         //
         Uint32 clientTimeout;          client.setTimeOut( (timeoutValue+2)*1000 );
         if (timeoutValue == 0)  
         {  
             String configTimeout =  
                 configManager->getCurrentValue("shutdownTimeout");  
            ArrayDestroyer<char> timeoutCString(configTimeout.allocateCString());  
             clientTimeout =  
                 ((strtol(timeoutCString.getPointer(), (char **)0,10))+2)*1000;  
         }  
         else  
         {  
             clientTimeout = (timeoutValue + 2)*1000;  
         }  
   
         client.setTimeOut(clientTimeout);  
     }     }
     catch(CIMClientException& e)     catch(CIMClientException& e)
     {     {
Line 344 
Line 327 
     Boolean useSSL = false;     Boolean useSSL = false;
     Boolean daemonOption = false;     Boolean daemonOption = false;
     Boolean shutdownOption = false;     Boolean shutdownOption = false;
     Boolean timeoutOption = false;      Uint32 timeoutValue  = 0;
     String  timeoutStr  = String::EMPTY;  
     long timeoutValue  = 0;  
  
     //     //
     // Get environment variables:     // Get environment variables:
Line 368 
Line 349 
     }     }
     else     else
     {     {
         // Get help, version and home options          // Get help, version, and shutdown options
  
         for (int i = 1; i < argc; )         for (int i = 1; i < argc; )
         {         {
Line 430 
Line 411 
                 //                 //
                 else if (*option == OPTION_SHUTDOWN)                 else if (*option == OPTION_SHUTDOWN)
                 {                 {
   
                     //                     //
                     // check to see if user is root                     // check to see if user is root
                     //                     //
Line 456 
Line 436 
                     memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));                     memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
                     argc--;                     argc--;
                 }                 }
                 else if (*option == OPTION_TIMEOUT)  
                 {  
                     //  
                     // Check to see if shutdown has been specified:  
                     //  
                     if (!shutdownOption)  
                     {  
                         cout << "Invalid option -" << option << endl;  
                         exit(0);  
                     }  
   
                     if (timeoutOption)  
                     {  
                         cout << "Duplicate timeout option specified." << endl;  
                         exit(0);  
                     }  
   
                     timeoutOption = true;  
   
                     if (i + 1 < argc)  
                     {  
                         // get timeout value  
                         timeoutStr.assign(argv[i + 1]);  
   
                         // validate timeout value string  
                         char* tmp = timeoutStr.allocateCString();  
                         char* end = 0;  
                         timeoutValue  = strtol(tmp, &end, 10);  
   
                         if (!end || *end != '\0')  
                         {  
                             cout << "invalid timeout value specified: ";  
                             cout << timeoutStr << endl;  
                             delete [] tmp;  
                             exit(0);  
                         }  
                     }  
                     else  
                     {  
                         cout << "Missing argument for option -";  
                         cout << option << endl;  
                         exit(0);  
                     }  
   
                     // remove the option from the command line  
                     memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));  
                     argc -= 2;  
                 }  
                 else                 else
                     i++;                     i++;
             }             }
Line 537 
Line 469 
         exit(1);         exit(1);
     }     }
  
   
     try     try
     {     {
         //         //
Line 606 
Line 537 
         //         //
         if (shutdownOption)         if (shutdownOption)
         {         {
             //              String configTimeout =
             // if timeout was specified, validate the timeout value                  configManager->getCurrentValue("shutdownTimeout");
             //              ArrayDestroyer<char> timeoutCString(configTimeout.allocateCString());
             if (timeoutOption)              timeoutValue = strtol(timeoutCString.getPointer(), (char **)0, 10);
             {  
                 Boolean valid = configManager->validatePropertyValue(  
                                              PROPERTY_TIMEOUT,  
                                              timeoutStr);  
                 if (!valid)  
                 {  
                     cout << "Invalid timeout value specified: " << timeoutValue;  
                     cout << endl;  
                     exit(1);  
                 }  
             }  
  
             shutdownCIMOM(timeoutValue);             shutdownCIMOM(timeoutValue);
  
             cout << "Pegasus CIM Server stopped." << endl;              cout << "CIM Server stopped." << endl;
             exit(0);             exit(0);
         }         }
  
Line 809 
Line 729 
     }     }
     catch(Exception& e)     catch(Exception& e)
     {     {
         Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,  
             "$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 1;
     }     }


Legend:
Removed from v.1.59  
changed lines
  Added in v.1.60

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2