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