version 1.55, 2002/05/29 19:30:54
|
version 1.56, 2002/05/31 18:13:24
|
|
|
// | // |
String hostStr = System::getHostName(); | String hostStr = System::getHostName(); |
| |
|
// Put server shutdown message to the logger |
|
Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION, |
|
"Stopping $0 version $1", PEGASUS_NAME, PEGASUS_VERSION); |
|
|
// | // |
// open connection to CIMOM | // open connection to CIMOM |
// | // |
|
|
// CIM Server gets shutdown, if CIM Server is still running at | // CIM Server gets shutdown, if CIM Server is still running at |
// this time, we will kill the cimserver process. | // this time, we will kill the cimserver process. |
// | // |
|
// give CIM Server some time to finish up |
#if defined(PEGASUS_OS_HPUX) |
// |
|
|
// give cimom some time to finish up |
|
System::sleep(1); | System::sleep(1); |
|
cimserver_kill(); |
// add code to kill cimom if it is still running |
|
|
|
#endif |
|
} | } |
catch(Exception& e) | catch(Exception& e) |
{ | { |
PEGASUS_STD(cerr) << "Failed to shutdown server: "; |
PEGASUS_STD(cerr) << "Error occurred while stopping the CIM Server: "; |
PEGASUS_STD(cerr) << e.getMessage() << PEGASUS_STD(endl); | PEGASUS_STD(cerr) << e.getMessage() << PEGASUS_STD(endl); |
exit(1); | exit(1); |
} | } |
|
|
| |
#if defined(PEGASUS_OS_HPUX) | #if defined(PEGASUS_OS_HPUX) |
// | // |
// create a file to indicate that the cimserver has started |
// create a file to indicate that the cimserver has started and |
// |
// save the process id of the cimserver process in the file |
fstream fs; |
|
ArrayDestroyer<char> p(CIMSERVERSTART_FILE.allocateCString()); |
|
fs.open(p.getPointer(), ios::in | ios::out); |
|
if (!fs) |
|
{ |
|
// |
|
// failed to create the file, write an entry to the log file |
|
// and proceed |
|
// | // |
//Logger::put(Logger::STANDARD_LOG, "CIMServer", |
|
// Logger::INFORMATION, |
// remove the old file if it exists |
// "Failed to open the $0 file needed by cimserverd.", |
System::removeFile(fname); |
// CIMSERVERSTART_FILE); |
|
} |
// open the file |
else |
FILE *pid_file = fopen(fname, "w"); |
|
if (pid_file) |
{ | { |
fs.close(); |
// save the pid in the file |
|
fprintf(pid_file, "%ld\n", (long)server_pid); |
|
fclose(pid_file); |
} | } |
#endif | #endif |
cout << "Started. " << endl; | cout << "Started. " << endl; |
|
|
| |
#if defined(PEGASUS_OS_HPUX) | #if defined(PEGASUS_OS_HPUX) |
// | // |
// close the file at startup time to indicate that the cimserver |
// close the file created at startup time to indicate that the |
// has terminated normally. |
// cimserver has terminated normally. |
// | // |
FileSystem::removeFile(CIMSERVERSTART_FILE); | FileSystem::removeFile(CIMSERVERSTART_FILE); |
#endif | #endif |