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 mateus.baur 1.193 char** argv,
246 const Boolean& shutdownOption)
|
247 mike 1.32 {
|
248 mike 1.35 try
|
249 mike 1.32 {
|
250 mateus.baur 1.193 if (shutdownOption)
251 {
252 cm->loadConfigFiles();
253 }
254 else
255 {
256 cm->mergeConfigFiles();
257 }
258
259 // Temporarily disable updates to the current configuration
260 // file if shutdownOption is true
261 cm->useConfigFiles = (shutdownOption==false);
|
262 mike 1.33
|
263 mike 1.35 cm->mergeCommandLine(argc, argv);
|
264 mateus.baur 1.193
265 // Enable updates again
266 cm->useConfigFiles = true;
|
267 mike 1.35 }
|
268 kumpf 1.122 catch (NoSuchFile&)
|
269 mike 1.35 {
|
270 kumpf 1.122 throw;
|
271 mike 1.35 }
|
272 kumpf 1.122 catch (FileNotReadable&)
|
273 mike 1.35 {
|
274 kumpf 1.122 throw;
|
275 mike 1.35 }
|
276 kumpf 1.122 catch (CannotRenameFile&)
|
277 mike 1.35 {
|
278 kumpf 1.122 throw;
|
279 mike 1.35 }
|
280 kumpf 1.122 catch (ConfigFileSyntaxError&)
|
281 mike 1.35 {
|
282 kumpf 1.122 throw;
|
283 mike 1.35 }
|
284 kumpf 1.122 catch(UnrecognizedConfigProperty&)
|
285 mike 1.35 {
|
286 kumpf 1.122 throw;
|
287 mike 1.35 }
|
288 kumpf 1.122 catch(InvalidPropertyValue&)
|
289 mike 1.35 {
|
290 kumpf 1.122 throw;
|
291 mike 1.35 }
|
292 kumpf 1.123 catch (CannotOpenFile&)
293 {
294 throw;
295 }
|
296 mike 1.32 }
297
298 /* PrintHelp - This is temporary until we expand the options manager to allow
299 options help to be defined with the OptionRow entries and presented from
300 those entries.
301 */
302 void PrintHelp(const char* arg0)
303 {
|
304 mike 1.35 String usage = String (USAGE);
305 usage.append (COMMAND_NAME);
306 usage.append (" [ [ options ] | [ configProperty=value, ... ] ]\n");
307 usage.append (" options\n");
|
308 a.arora 1.142 usage.append (" -v, --version - displays CIM Server version number\n");
309 usage.append (" -h, --help - prints this help message\n");
|
310 humberto 1.97 usage.append (" -s - shuts down CIM Server\n");
|
311 kumpf 1.138 #if !defined(PEGASUS_USE_RELEASE_DIRS)
312 usage.append (" -D [home] - sets pegasus home directory\n");
|
313 humberto 1.97 #endif
314 #if defined(PEGASUS_OS_TYPE_WINDOWS)
|
315 joyce.j 1.148 usage.append (" -install [name] - installs pegasus as a Windows Service\n");
|
316 humberto 1.97 usage.append (" [name] is optional and overrides the\n");
317 usage.append (" default CIM Server Service Name\n");
|
318 aruran.ms 1.183 usage.append (" by appending [name]\n");
|
319 joyce.j 1.148 usage.append (" -remove [name] - removes pegasus as a Windows Service\n");
|
320 humberto 1.97 usage.append (" [name] is optional and overrides the\n");
321 usage.append (" default CIM Server Service Name\n");
|
322 aruran.ms 1.183 usage.append (" by appending [name]\n");
|
323 joyce.j 1.148 usage.append (" -start [name] - starts pegasus as a Windows Service\n");
|
324 humberto 1.97 usage.append (" [name] is optional and overrides the\n");
325 usage.append (" default CIM Server Service Name\n");
|
326 aruran.ms 1.183 usage.append (" by appending [name]\n");
|
327 joyce.j 1.148 usage.append (" -stop [name] - stops pegasus as a Windows Service\n");
|
328 humberto 1.97 usage.append (" [name] is optional and overrides the\n");
|
329 aruran.ms 1.183 usage.append (" default CIM Server Service Name\n");
330 usage.append (" by appending [name]\n\n");
|
331 humberto 1.97 #endif
332 usage.append (" configProperty=value\n");
333 usage.append (" - sets CIM Server configuration property\n");
334
335 cout << endl;
|
336 jim.wunderlich 1.180 cout << _cimServerProcess->getProductName() << " " << _cimServerProcess->getCompleteVersion() << endl;
|
337 humberto 1.97 cout << endl;
|
338 david.dillard 1.165
|
339 humberto 1.97 #if defined(PEGASUS_OS_TYPE_WINDOWS)
|
340 humberto 1.104 MessageLoaderParms parms("src.Server.cimserver.MENU.WINDOWS", usage);
|
341 kumpf 1.152 #elif defined(PEGASUS_USE_RELEASE_DIRS)
|
342 kumpf 1.138 MessageLoaderParms parms("src.Server.cimserver.MENU.HPUXLINUXIA64GNU", usage);
|
343 humberto 1.97 #else
|
344 kumpf 1.138 MessageLoaderParms parms("src.Server.cimserver.MENU.STANDARD", usage);
|
345 humberto 1.97 #endif
346 cout << MessageLoader::getMessage(parms) << endl;
|
347 mike 1.35 }
348
|
349 h.sterling 1.156 //This needs to be called at various points in the code depending on the platform and error conditions.
350 //We need to delete the _cimServer reference on exit in order for the destructors to get called.
351 void deleteCIMServer()
352 {
353 if (_cimServer)
354 {
355 delete _cimServer;
356 _cimServer = 0;
|
357 carolann.graves 1.171
358 #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) \
359 || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) \
360 || defined(PEGASUS_OS_SOLARIS) || defined(PEGASUS_OS_VMS)
361 //
362 // Remove the PID file to indicate CIMServer termination
363 //
364 FileSystem::removeFile(_cimServerProcess->getPIDFileName());
365 #endif
|
366 h.sterling 1.156 }
|
367 kumpf 1.182 delete _monitor;
|
368 konrad.r 1.166 if (dummyInitialThread)
369 {
370 Thread::clearLanguages();
371 delete dummyInitialThread;
372 }
|
373 h.sterling 1.156 }
374
|
375 chuck 1.96 // l10n
376 //
377 // Dummy function for the Thread object associated with the initial thread.
378 // Since the initial thread is used to process CIM requests, this is
379 // needed to localize the exceptions thrown during CIM request processing.
|
380 david.dillard 1.165 // Note: This function should never be called!
381 //
|
382 mike 1.188 ThreadReturnType PEGASUS_THREAD_CDECL dummyThreadFunc(void *parm)
|
383 chuck 1.96 {
|
384 mike 1.188 return((ThreadReturnType)0);
|
385 chuck 1.96 }
386
|
387 carolann.graves 1.171 //
388 // Waits until either the CIM Server has terminated, or the shutdown timeout
389 // has expired. If the shutdown timeout has expired, and the CIM Server is
390 // still running, kills the cimserver process.
391 //
392 void _waitForTerminationOrTimeout (Uint32 maxWaitTime)
393 {
394 //
395 // If the CIM Server is still running, and the shutdown timeout has not
396 // expired, loop and wait one second until either the CIM Server has
397 // terminated, or the shutdown timeout has expired
398 //
399 Boolean running = _cimServerProcess->isCIMServerRunning ();
400 while (running && (maxWaitTime > 0))
401 {
402 System::sleep (1);
403 running = _cimServerProcess->isCIMServerRunning ();
404 maxWaitTime--;
405 }
406
407 //
408 carolann.graves 1.171 // If the shutdown timeout has expired, and the CIM Server is still
409 // running, kill the cimserver process
410 //
411 if (running)
412 {
413 int kill_rc = _cimServerProcess->cimserver_kill (0);
414
415 #ifdef PEGASUS_OS_OS400
416 if (kill_rc == -1)
417 {
418 _cimServerProcess->cimserver_exitRC (2);
419 }
420 _cimServerProcess->cimserver_exitRC (1);
421 #endif
422
423 #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) \
424 || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_SOLARIS) \
425 || defined (PEGASUS_OS_VMS)
426 if (kill_rc != -1)
427 {
428 //l10n - TODO
429 carolann.graves 1.171 Logger::put_l (Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
430 "src.Server.cimserver.TIMEOUT_EXPIRED_SERVER_KILLED",
431 "Shutdown timeout expired. Forced shutdown initiated.");
432 MessageLoaderParms parms
433 ("src.Server.cimserver.TIMEOUT_EXPIRED_SERVER_KILLED",
434 "Shutdown timeout expired. Forced shutdown initiated.");
435 cout << MessageLoader::getMessage(parms) << endl;
436 exit (0);
437 }
438 #endif
439 }
440 }
441
|
442 kumpf 1.52 void shutdownCIMOM(Uint32 timeoutValue)
|
443 mike 1.35 {
444 //
445 // Create CIMClient object
446 //
|
447 kumpf 1.42 CIMClient client;
|
448 mike 1.35
449 //
|
450 kumpf 1.53 // Get local host name
|
451 mike 1.35 //
452 String hostStr = System::getHostName();
453
454 //
|
455 david.dillard 1.165 // open connection to CIMOM
|
456 mike 1.35 //
457 try
458 {
|
459 kumpf 1.43 client.connectLocal();
|
460 kumpf 1.52
461 //
|
462 kumpf 1.63 // set client timeout to 2 seconds
|
463 kumpf 1.52 //
|
464 kumpf 1.71 client.setTimeout(2000);
|
465 mike 1.35 }
|
466 s.hills 1.117 catch(Exception&)
|
467 mike 1.35 {
|
468 david 1.85 #ifdef PEGASUS_OS_OS400
|
469 h.sterling 1.153 //l10n
470 //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
471 //"Unable to connect to CIM Server. CIM Server may not be running." );
472 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
473 "src.Server.cimserver.UNABLE_CONNECT_SERVER_MAY_NOT_BE_RUNNING",
474 "Unable to connect to CIM Server. CIM Server may not be running." );
475 // The server job may still be active but not responding.
476 // Kill the job if it exists.
477 if(_cimServerProcess->cimserver_kill(0) == -1)
478 _cimServerProcess->cimserver_exitRC(2);
479 _cimServerProcess->cimserver_exitRC(1);
|
480 david 1.85 #else
|
481 humberto 1.97 //l10n
482 //PEGASUS_STD(cerr) << "Unable to connect to CIM Server." << PEGASUS_STD(endl);
483 //PEGASUS_STD(cerr) << "CIM Server may not be running." << PEGASUS_STD(endl);
484 MessageLoaderParms parms("src.Server.cimserver.UNABLE_CONNECT_SERVER_MAY_NOT_BE_RUNNING",
|
485 kumpf 1.105 "Unable to connect to CIM Server.\nCIM Server may not be running.\n");
|
486 humberto 1.97 PEGASUS_STD(cerr) << MessageLoader::getMessage(parms);
|
487 s.hills 1.117 exit(1);
|
488 chuck 1.66 #endif
|
489 mike 1.35 }
490
491 try
492 {
493 //
|
494 kumpf 1.52 // construct CIMObjectPath
|
495 mike 1.35 //
496 String referenceStr = "//";
497 referenceStr.append(hostStr);
|
498 david.dillard 1.165 referenceStr.append("/");
|
499 kumpf 1.72 referenceStr.append(PEGASUS_NAMESPACENAME_SHUTDOWN.getString());
|
500 kumpf 1.53 referenceStr.append(":");
|
501 kumpf 1.72 referenceStr.append(PEGASUS_CLASSNAME_SHUTDOWN.getString());
|
502 kumpf 1.50 CIMObjectPath reference(referenceStr);
|
503 mike 1.35
504 //
505 // issue the invokeMethod request on the shutdown method
506 //
507 Array<CIMParamValue> inParams;
508 Array<CIMParamValue> outParams;
509
|
510 kumpf 1.52 // set force option to true for now
|
511 kumpf 1.40 inParams.append(CIMParamValue("force",
|
512 kumpf 1.52 CIMValue(Boolean(true))));
|
513 mike 1.35
|
514 kumpf 1.40 inParams.append(CIMParamValue("timeout",
|
515 kumpf 1.39 CIMValue(Uint32(timeoutValue))));
|
516 mike 1.35
517 CIMValue retValue = client.invokeMethod(
|
518 kumpf 1.59 PEGASUS_NAMESPACENAME_SHUTDOWN,
|
519 mike 1.35 reference,
520 "shutdown",
521 inParams,
522 outParams);
|
523 kumpf 1.43 }
|
524 kumpf 1.65 catch(CIMException& e)
|
525 kumpf 1.46 {
|
526 david 1.85 #ifdef PEGASUS_OS_OS400
527
|
528 h.sterling 1.153 if (e.getCode() == CIM_ERR_INVALID_NAMESPACE)
529 {
530 //l10n
531 //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
532 //"Failed to shutdown server: $0", "The repository may be empty.");
533 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
534 "src.Server.cimserver.SHUTDOWN_FAILED_REPOSITORY_EMPTY",
535 "Error in server shutdown: The repository may be empty.");
536 }
537 else
538 {
539 //l10n
540 //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
541 //"Failed to shutdown server: $0", e.getMessage());
542 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
543 "src.Server.cimserver.SHUTDOWN_FAILED",
544 "Error in server shutdown: $0", e.getMessage());
545 }
546 // Kill the server job.
547 if(_cimServerProcess->cimserver_kill(0) == -1)
548 _cimServerProcess->cimserver_exitRC(2);
|
549 david 1.85 #else
|
550 kumpf 1.105 //l10n - TODO
|
551 humberto 1.97 MessageLoaderParms parms("src.Server.cimserver.SHUTDOWN_FAILED",
|
552 kumpf 1.105 "Error in server shutdown: ");
|
553 humberto 1.97 PEGASUS_STD(cerr) << MessageLoader::getMessage(parms);
|
554 kumpf 1.63 if (e.getCode() == CIM_ERR_INVALID_NAMESPACE)
555 {
|
556 kumpf 1.105 //
|
557 david.dillard 1.165 // Repository may be empty.
|
558 kumpf 1.105 //
559 //l10n - TODO
560 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
561 "src.Server.cimserver.SHUTDOWN_FAILED_REPOSITORY_EMPTY",
562 "Error in server shutdown: The repository may be empty.");
|
563 humberto 1.97 MessageLoaderParms parms("src.Server.cimserver.REPOSITORY_EMPTY",
|
564 kumpf 1.105 "The repository may be empty.");
565 PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);
|
566 kumpf 1.63 }
567 else
568 {
|
569 kumpf 1.105 //l10n - TODO
570 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
571 "src.Server.cimserver.SHUTDOWN_FAILED",
572 "Error in server shutdown: $0", e.getMessage());
|
573 kumpf 1.63 PEGASUS_STD(cerr) << e.getMessage() << PEGASUS_STD(endl);
574 }
|
575 kumpf 1.105
|
576 david.dillard 1.165 // Kill the cimserver process
|
577 h.sterling 1.153 if (_cimServerProcess->cimserver_kill(0) == 0)
|
578 kumpf 1.105 {
579 //l10n - TODO
580 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
581 "src.Server.cimserver.SERVER_FORCED_SHUTDOWN",
|
582 h.sterling 1.153 "Forced shutdown initiated.");
|
583 kumpf 1.105 MessageLoaderParms parms("src.Server.cimserver.SERVER_FORCED_SHUTDOWN",
584 "Forced shutdown initiated.");
585 PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);
586 }
|
587 s.hills 1.117 exit(1);
|
588 chuck 1.66 #endif
|
589 kumpf 1.46 }
|
590 s.hills 1.117 catch(Exception&)
|
591 kumpf 1.45 {
592 //
|
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.35
|
617 mike 1.33 /////////////////////////////////////////////////////////////////////////
|
618 mike 1.32 // MAIN
619 //////////////////////////////////////////////////////////////////////////
620 int main(int argc, char** argv)
621 {
|
622 kumpf 1.196 String pegasusHome;
|
623 mike 1.35 Boolean shutdownOption = false;
|
624 kumpf 1.178 Boolean debugOutputOption = false;
|
625 mday 1.47
|
626 humberto 1.97 //l10n
627 // Set Message loading to process locale
|
628 david.dillard 1.165 MessageLoader::_useProcessLocale = true;
|
629 humberto 1.97 //l10n
630
|
631 kv.le 1.140 //l10n
632 #if defined(PEGASUS_OS_AIX) && defined(PEGASUS_HAS_MESSAGES)
633 setlocale(LC_ALL, "");
634 #endif
635
|
636 chuck 1.66 #ifdef PEGASUS_OS_OS400
|
637 david 1.120
638 VFYPTRS_INCDCL; // VFYPTRS local variables
639
640 // verify pointers
641 #pragma exception_handler (qsyvp_excp_hndlr,qsyvp_excp_comm_area,\
642 0,_C2_MH_ESCAPE)
643 for( int arg_index = 1; arg_index < argc; arg_index++ ){
|
644 h.sterling 1.153 VFYPTRS(VERIFY_SPP_NULL(argv[arg_index]));
|
645 david 1.120 }
646 #pragma disable_handler
647
|
648 david 1.100 // Convert the args to ASCII
649 for(Uint32 i = 0;i< argc;++i)
650 {
|
651 h.sterling 1.153 EtoA(argv[i]);
|
652 david 1.100 }
653
|
654 chuck 1.66 // Initialize Pegasus home to the shipped OS/400 directory.
655 pegasusHome = OS400_DEFAULT_PEGASUS_HOME;
656 #endif
657
|
658 kv.le 1.134
|
659 tony 1.82 #ifndef PEGASUS_OS_TYPE_WINDOWS
|
660 kumpf 1.38 //
661 // Get environment variables:
662 //
|
663 david 1.100 #ifdef PEGASUS_OS_OS400
664 #pragma convert(37)
665 const char* tmp = getenv("PEGASUS_HOME");
666 #pragma convert(0)
667 char home[256] = {0};
668 if (tmp && strlen(tmp) < 256)
669 {
|
670 h.sterling 1.153 strcpy(home, tmp);
671 EtoA(home);
672 pegasusHome = home;
|
673 david 1.100 }
674 #else
|
675 kv.le 1.134 #if defined(PEGASUS_OS_AIX) && defined(PEGASUS_USE_RELEASE_DIRS)
676 pegasusHome = AIX_RELEASE_PEGASUS_HOME;
|
677 marek 1.170 #elif !defined(PEGASUS_USE_RELEASE_DIRS) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
|
678 kumpf 1.38 const char* tmp = getenv("PEGASUS_HOME");
679
680 if (tmp)
681 {
682 pegasusHome = tmp;
683 }
|
684 kv.le 1.134 #endif
|
685 david 1.100 #endif
|
686 kumpf 1.38
687 FileSystem::translateSlashes(pegasusHome);
|
688 tony 1.82 #else
|
689 kumpf 1.38
|
690 tony 1.82 // windows only
|
691 h.sterling 1.153 //setHome(pegasusHome);
692 pegasusHome = _cimServerProcess->getHome();
|
693 tony 1.82 #endif
|
694 mike 1.32
|
695 kumpf 1.60 // Get help, version, and shutdown options
|
696 mike 1.35
697 for (int i = 1; i < argc; )
698 {
699 const char* arg = argv[i];
|
700 a.arora 1.142 if(String::equal(arg,"--help"))
701 {
702 PrintHelp(argv[0]);
703 exit(0);
704 }
705 else if(String::equal(arg,"--version"))
706 {
|
707 jim.wunderlich 1.180 cout << _cimServerProcess->getCompleteVersion() << endl;
|
708 a.arora 1.142 exit(0);
709 }
|
710 mike 1.35 // Check for -option
|
711 a.arora 1.142 else if (*arg == '-')
|
712 mike 1.35 {
713 // Get the option
714 const char* option = arg + 1;
715
716 //
717 // Check to see if user asked for the version (-v option):
718 //
|
719 tony 1.83 if (*option == OPTION_VERSION &&
720 strlen(option) == 1)
|
721 mike 1.35 {
|
722 jim.wunderlich 1.180 cout << _cimServerProcess->getCompleteVersion() << endl;
|
723 mike 1.35 exit(0);
724 }
725 //
726 // Check to see if user asked for help (-h option):
727 //
|
728 tony 1.83 else if (*option == OPTION_HELP &&
729 (strlen(option) == 1))
|
730 mike 1.35 {
731 PrintHelp(argv[0]);
732 exit(0);
733 }
|
734 kumpf 1.138 #if !defined(PEGASUS_USE_RELEASE_DIRS)
|
735 tony 1.83 else if (*option == OPTION_HOME &&
736 (strlen(option) == 1))
|
737 mike 1.35 {
|
738 kumpf 1.60 if (i + 1 < argc)
|
739 mike 1.35 {
740 pegasusHome.assign(argv[i + 1]);
741 }
742 else
743 {
|
744 humberto 1.97 //l10n
745 //cout << "Missing argument for option -" << option << endl;
|
746 humberto 1.99 String opt(option);
|
747 humberto 1.97 MessageLoaderParms parms("src.Server.cimserver.MISSING_ARGUMENT",
|
748 h.sterling 1.153 "Missing argument for option -$0",
749 opt);
750 cout << MessageLoader::getMessage(parms) << endl;
|
751 mike 1.35 exit(0);
752 }
753
754 memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));
755 argc -= 2;
756 }
|
757 kumpf 1.63 #endif
|
758 kumpf 1.48 //
|
759 kumpf 1.178 // Check to see if user asked for debug output (-X option):
|
760 kumpf 1.48 //
|
761 kumpf 1.178 else if (*option == OPTION_DEBUGOUTPUT &&
|
762 tony 1.83 (strlen(option) == 1))
|
763 kumpf 1.48 {
|
764 kumpf 1.178 MessageLoaderParms parms(
765 "src.Server.cimserver.UNSUPPORTED_DEBUG_OPTION",
766 "Unsupported debug output option is enabled.");
|
767 h.sterling 1.153 cout << MessageLoader::getMessage(parms) << endl;
|
768 kumpf 1.178
769 debugOutputOption = true;
770
771 #if defined(PEGASUS_OS_HPUX)
772 System::bindVerbose = true;
773 #endif
774
|
775 kumpf 1.48 // remove the option from the command line
776 memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
|
777 david.dillard 1.165 argc--;
|
778 kumpf 1.48 }
|
779 mike 1.35 //
780 // Check to see if user asked for shutdown (-s option):
781 //
|
782 tony 1.82 else if (*option == OPTION_SHUTDOWN &&
783 (strlen(option) == 1))
|
784 mike 1.35 {
785 //
|
786 kumpf 1.52 // Check to see if shutdown has already been specified:
|
787 mike 1.35 //
|
788 kumpf 1.52 if (shutdownOption)
|
789 mike 1.35 {
|
790 humberto 1.97 //l10n
791 //cout << "Duplicate shutdown option specified." << endl;
792 MessageLoaderParms parms("src.Server.cimserver.DUPLICATE_SHUTDOWN_OPTION",
|
793 h.sterling 1.153 "Duplicate shutdown option specified.");
|
794 david.dillard 1.165
|
795 humberto 1.97 cout << MessageLoader::getMessage(parms) << endl;
|
796 mike 1.35 exit(0);
797 }
798
|
799 kumpf 1.52 shutdownOption = true;
|
800 david.dillard 1.165
|
801 mike 1.35 // remove the option from the command line
802 memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
|
803 david.dillard 1.165 argc--;
|
804 mike 1.35 }
805 else
806 i++;
807 }
808 else
809 i++;
|
810 mike 1.32 }
|
811 mike 1.35
|
812 kumpf 1.38 //
813 // Set the value for pegasusHome property
814 //
815 ConfigManager::setPegasusHome(pegasusHome);
|
816 mike 1.32
|
817 mike 1.35 //
|
818 carolann.graves 1.171 // Do the platform specific run
|
819 s.hills 1.117 //
820
|
821 kumpf 1.178 return _cimServerProcess->platform_run(
822 argc, argv, shutdownOption, debugOutputOption);
|
823 s.hills 1.117 }
824
|
825 h.sterling 1.153 void CIMServerProcess::cimserver_stop()
826 {
827 _cimServer->shutdownSignal();
828 }
|
829 s.hills 1.117
830 //
831 // The main, common, running code
832 //
|
833 david.dillard 1.165 // NOTE: Do NOT call exit(). Use return(), otherwise some platforms
|
834 s.hills 1.117 // will fail to shutdown properly/cleanly.
835 //
|
836 david.dillard 1.165 // TODO: Current change minimal for platform "service" shutdown bug fixes.
|
837 carolann.graves 1.171 // Perhaps further extract out common stuff and put into main(), put
|
838 david.dillard 1.165 // daemon stuff into platform specific platform_run(), etc.
839 // Note: make sure to not put error handling stuff that platform
|
840 carolann.graves 1.171 // specific runs may need to deal with better (instead of exit(), etc).
|
841 s.hills 1.117 //
842
|
843 kumpf 1.178 int CIMServerProcess::cimserver_run(
844 int argc,
845 char** argv,
846 Boolean shutdownOption,
847 Boolean debugOutputOption)
|
848 s.hills 1.117 {
|
849 kumpf 1.196 String logsDirectory;
|
850 s.hills 1.117 Boolean daemonOption = false;
851
852 //
|
853 mike 1.35 // Get an instance of the Config Manager.
854 //
855 configManager = ConfigManager::getInstance();
|
856 kumpf 1.136 configManager->useConfigFiles = true;
|
857 mike 1.35
|
858 lucier 1.130 #ifdef PEGASUS_OS_OS400
859 // In a special startup case for IBM OS400, when the server is
860 // automatically started when the machine starts up the config
861 // file cannot be read because of access restrictions for the
862 // user starting the server. In this case, we need to skip
863 // reading the config options and therefore any use of the config
864 // manager also. To make this determinations we will check to see
865 // if the daemon flag is set to true. If so, then there will be a
866 // series of checks to bracket all the calls to the configManager
867 // which would otherwise fail. All this will only be done for
868 // IBM OS400.
869
870 Boolean os400StartupOption = false;
871 // loop through args to check for daemon=true
872 for (int i=1; i < argc; i++)
873 if (strcmp(argv[i], "daemon=true") == 0)
874 {
875 os400StartupOption = true;
876 daemonOption = true;
877 }
|
878 chuck 1.164
879 if (!os400StartupOption)
880 {
881 // If this is the server job, then set the job
882 // to save the job log.
883 system ("QSYS/CHGJOB JOB(*) LOG(4 00 *SECLVL)");
884 }
|
885 david.dillard 1.165 #endif
|
886 lucier 1.130
|
887 mike 1.35 //
|
888 mike 1.32 // Get options (from command line and from configuration file); this
|
889 mike 1.35 // removes corresponding options and their arguments from the command
|
890 mike 1.32 // line.
|
891 mike 1.35 //
|
892 mike 1.32 try
893 {
|
894 lucier 1.130 #ifdef PEGASUS_OS_OS400
895 if (os400StartupOption == false)
|
896 david.dillard 1.165 #endif
|
897 mateus.baur 1.193 // If current process is "cimserver -s" (shutdown option = true) the contents
898 // of current config should not be overwriten by planned config
899 GetOptions(configManager, argc, argv, shutdownOption);
|
900 mike 1.32 }
901 catch (Exception& e)
902 {
|
903 kumpf 1.127 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
904 "src.Server.cimserver.SERVER_NOT_STARTED",
905 "cimserver not started: $0", e.getMessage());
906
907 #if !defined(PEGASUS_OS_OS400)
908 MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED",
909 "cimserver not started: $0", e.getMessage());
910
911 PEGASUS_STD(cerr) << argv[0] << ": " << MessageLoader::getMessage(parms)
912 << PEGASUS_STD(endl);
|
913 david 1.85 #endif
|
914 kumpf 1.127
|
915 s.hills 1.117 return(1);
|
916 mike 1.32 }
917
|
918 chuck 1.94 // l10n
|
919 h.sterling 1.153 // Set the home directory, msg sub-dir, into the MessageLoader.
|
920 david.dillard 1.165 // This will be the default directory where the resource bundles
921 // are found.
|
922 h.sterling 1.153 MessageLoader::setPegasusMsgHome(ConfigManager::getHomedPath(
|
923 david.dillard 1.165 ConfigManager::getInstance()->getCurrentValue("messageDir")));
|
924 chuck 1.94
|
925 lucier 1.130 #ifdef PEGASUS_OS_OS400
926 // Still need to declare and set the connection variables.
927 // Will initialize to false since they are fixed at false for OS400.
928
929 // NOTE: OS400 is a LOCAL_DOMAIN_SOCKET, so a few lines down
930 // the test will not be compiled in. If OS400 ever turns off that
931 // define, then we will need to change this code path to insure that
|
932 david.dillard 1.165 // one of the variables is true.
|
933 lucier 1.130 Boolean enableHttpConnection = false;
934 Boolean enableHttpsConnection = false;
935
936 if (os400StartupOption == false)
937 {
|
938 kumpf 1.187 enableHttpConnection = ConfigManager::parseBooleanValue(
939 configManager->getCurrentValue("enableHttpConnection"));
940 enableHttpsConnection = ConfigManager::parseBooleanValue(
941 configManager->getCurrentValue("enableHttpsConnection"));
|
942 lucier 1.130 }
943 #else
|
944 kumpf 1.187 Boolean enableHttpConnection = ConfigManager::parseBooleanValue(
945 configManager->getCurrentValue("enableHttpConnection"));
946 Boolean enableHttpsConnection = ConfigManager::parseBooleanValue(
947 configManager->getCurrentValue("enableHttpsConnection"));
|
948 lucier 1.130 #endif
|
949 kumpf 1.86
950 // Make sure at least one connection is enabled
|
951 h.sterling 1.159 #ifdef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
|
952 kumpf 1.86 if (!enableHttpConnection && !enableHttpsConnection)
953 {
|
954 humberto 1.97 //l10n
955 //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
956 //"Neither HTTP nor HTTPS connection is enabled. "
957 //"CIMServer will not be started.");
958 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
|
959 h.sterling 1.153 "src.Server.cimserver.HTTP_NOT_ENABLED_SERVER_NOT_STARTING",
|
960 humberto 1.97 "Neither HTTP nor HTTPS connection is enabled. CIMServer will not be started.");
961 //cerr << "Neither HTTP nor HTTPS connection is enabled. "
962 //"CIMServer will not be started." << endl;
963 MessageLoaderParms parms("src.Server.cimserver.HTTP_NOT_ENABLED_SERVER_NOT_STARTING",
|
964 h.sterling 1.153 "Neither HTTP nor HTTPS connection is enabled. CIMServer will not be started.");
|
965 humberto 1.97 cerr << MessageLoader::getMessage(parms) << endl;
|
966 s.hills 1.117 return(1);
|
967 kumpf 1.86 }
968 #endif
969
|
970 mike 1.35 try
|
971 mike 1.32 {
|
972 mike 1.35 //
|
973 kumpf 1.187 // Check to see if we should start Pegasus as a daemon
|
974 mike 1.35 //
975
|
976 kumpf 1.187 daemonOption = ConfigManager::parseBooleanValue(
977 configManager->getCurrentValue("daemon"));
|
978 david.dillard 1.165
|
979 lucier 1.130 #ifdef PEGASUS_OS_OS400
980 if (os400StartupOption == false)
981 {
|
982 david.dillard 1.165 #endif
|
983 konrad.r 1.161 #if !defined(PEGASUS_USE_SYSLOGS)
|
984 david.dillard 1.165 logsDirectory =
|
985 h.sterling 1.153 ConfigManager::getHomedPath(configManager->getCurrentValue("logdir"));
|
986 konrad.r 1.161 #endif
|
987 lucier 1.130 #ifdef PEGASUS_OS_OS400
988 } // end if (os400StartupOption == false)
989 #endif
|
990 kumpf 1.36
991 // Set up the Logger. This does not open the logs
992 // Might be more logical to clean before set.
993 // ATTN: Need tool to completely disable logging.
994
|
995 david 1.85 #if !defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) && \
|
996 konrad.r 1.161 !defined(PEGASUS_OS_OS400) && !defined(PEGASUS_USE_SYSLOGS)
|
997 kumpf 1.36 Logger::setHomeDirectory(logsDirectory);
|
998 kumpf 1.57 #endif
|
999 kumpf 1.36
1000 //
|
1001 david.dillard 1.165 // Check to see if we need to shutdown CIMOM
|
1002 mike 1.35 //
1003 if (shutdownOption)
1004 {
|
1005 david.dillard 1.165 String configTimeout =
|
1006 kumpf 1.60 configManager->getCurrentValue("shutdownTimeout");
|
1007 s.hills 1.117 Uint32 timeoutValue = strtol(configTimeout.getCString(), (char **)0, 10);
|
1008 dave.sudlik 1.191 // To deregister Pegasus with SLP
1009 #ifdef PEGASUS_SLP_REG_TIMEOUT
1010 unregisterPegasusFromSLP();
1011 #endif
|
1012 david.dillard 1.165
|
1013 kumpf 1.52 shutdownCIMOM(timeoutValue);
|
1014 kumpf 1.45
|
1015 david 1.85 #ifdef PEGASUS_OS_OS400
|
1016 h.sterling 1.153 //l10n
1017 //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,
|
1018 david.dillard 1.165 //"CIM Server stopped.");
|
1019 h.sterling 1.153 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,
1020 "src.Server.cimserver.SERVER_STOPPED",
1021 "CIM Server stopped.");
|
1022 s.hills 1.117 cimserver_exitRC(0);
|
1023 david 1.85 #else
|
1024 h.sterling 1.153 //l10n
|
1025 humberto 1.97 //cout << "CIM Server stopped." << endl;
1026 MessageLoaderParms parms("src.Server.cimserver.SERVER_STOPPED",
|
1027 h.sterling 1.153 "CIM Server stopped.");
|
1028 humberto 1.106
|
1029 humberto 1.97 cout << MessageLoader::getMessage(parms) << endl;
|
1030 s.hills 1.117 return(0);
|
1031 diane 1.81 #endif
|
1032 mike 1.35 }
|
1033 mike 1.32
|
1034 kumpf 1.139 #if defined(PEGASUS_DEBUG)
|
1035 kumpf 1.36 // Leave this in until people get familiar with the logs.
|
1036 humberto 1.97 //l10n
1037 //cout << "Logs Directory = " << logsDirectory << endl;
|
1038 konrad.r 1.161 #if !defined(PEGASUS_USE_SYSLOGS)
|
1039 humberto 1.97 MessageLoaderParms parms("src.Server.cimserver.LOGS_DIRECTORY",
|
1040 h.sterling 1.153 "Logs Directory = ");
|
1041 humberto 1.97 cout << MessageLoader::getMessage(parms) << logsDirectory << endl;
|
1042 kumpf 1.57 #endif
|
1043 konrad.r 1.161 #endif
|
1044 mike 1.32 }
|
1045 kumpf 1.122 catch (UnrecognizedConfigProperty& e)
|
1046 mike 1.32 {
|
1047 marek 1.186 // UnrecognizedConfigProperty is already translated
1048 // thus, just output the message
1049 Logger::put(Logger::ERROR_LOG,
1050 System::CIMSERVER,
1051 Logger::SEVERE,
1052 e.getMessage());
1053 #ifndef PEGASUS_OS_OS400
1054 cout << e.getMessage() << endl;
1055 #endif
1056 }
1057 catch (Exception& ex)
1058 {
1059 Logger::put(Logger::ERROR_LOG,
1060 System::CIMSERVER,
1061 Logger::SEVERE,
1062 ex.getMessage());
1063 #ifndef PEGASUS_OS_OS400
1064 cout << ex.getMessage() << endl;
1065 #endif
1066 exit(1);
1067 }
|
1068 david 1.85
|
1069 marek 1.186 #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) && defined(PEGASUS_ZOS_SECURITY)
1070 startupCheckBPXServer(true);
1071 startupCheckProfileCIMSERVclassWBEM();
1072 startupEnableMSC();
|
1073 david 1.85 #endif
|
1074 mike 1.32
|
1075 h.sterling 1.158 // Bug 2148 - Here is the order of operations for determining the server HTTP and HTTPS ports.
1076 // 1) If the user explicitly specified a port, use it.
1077 // 2) If the user did not specify a port, get the port from the services file.
1078 // 3) If no value is specified in the services file, use the IANA WBEM default port.
1079 // Note that 2 and 3 are done within the System::lookupPort method
1080 // An empty string from the ConfigManager implies that the user did not specify a port.
1081
|
1082 w.otsuka 1.147 Uint32 portNumberHttps=0;
1083 Uint32 portNumberHttp=0;
1084 Uint32 portNumberExportHttps=0;
|
1085 kumpf 1.53
|
1086 kumpf 1.86 if (enableHttpsConnection)
|
1087 kumpf 1.53 {
|
1088 kumpf 1.86 String httpsPort = configManager->getCurrentValue("httpsPort");
|
1089 h.sterling 1.158 if (httpsPort == String::EMPTY)
|
1090 joyce.j 1.144 {
|
1091 h.sterling 1.158 //
1092 // Look up the WBEM-HTTPS port number
1093 //
1094 portNumberHttps = System::lookupPort(WBEM_HTTPS_SERVICE_NAME, WBEM_DEFAULT_HTTPS_PORT);
1095
1096 } else
|
1097 david.dillard 1.165 {
|
1098 h.sterling 1.158 //
1099 // user-specified
1100 //
1101 CString portString = httpsPort.getCString();
1102 char* end = 0;
1103 portNumberHttps = strtol(portString, &end, 10);
1104 if(!(end != 0 && *end == '\0'))
1105 {
|
1106 joyce.j 1.160 InvalidPropertyValue e("httpsPort", httpsPort);
|
1107 aruran.ms 1.173 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
1108 "src.Server.cimserver.SERVER_NOT_STARTED",
1109 "cimserver not started: $0", e.getMessage());
1110 #if !defined(PEGASUS_OS_OS400)
1111 MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED",
1112 "cimserver not started: $0", e.getMessage());
1113 PEGASUS_STD(cerr) << argv[0] << ": " << MessageLoader::getMessage(parms)
1114 << PEGASUS_STD(endl);
1115 #endif
|
1116 h.sterling 1.158 exit(1);
1117 }
|
1118 joyce.j 1.144 }
|
1119 kumpf 1.53 }
|
1120 kumpf 1.86
1121 if (enableHttpConnection)
|
1122 kumpf 1.53 {
|
1123 kumpf 1.86 String httpPort = configManager->getCurrentValue("httpPort");
|
1124 h.sterling 1.158 if (httpPort == String::EMPTY)
|
1125 joyce.j 1.144 {
|
1126 h.sterling 1.158 //
1127 // Look up the WBEM-HTTP port number
1128 //
1129 portNumberHttp = System::lookupPort(WBEM_HTTP_SERVICE_NAME, WBEM_DEFAULT_HTTP_PORT);
1130
1131 } else
1132 {
1133 //
1134 // user-specified
1135 //
1136 CString portString = httpPort.getCString();
1137 char* end = 0;
1138 portNumberHttp = strtol(portString, &end, 10);
1139 if(!(end != 0 && *end == '\0'))
1140 {
|
1141 joyce.j 1.160 InvalidPropertyValue e("httpPort", httpPort);
|
1142 aruran.ms 1.173 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
1143 "src.Server.cimserver.SERVER_NOT_STARTED",
1144 "cimserver not started: $0", e.getMessage());
1145 #if !defined(PEGASUS_OS_OS400)
1146 MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED",
1147 "cimserver not started: $0", e.getMessage());
1148 PEGASUS_STD(cerr) << argv[0] << ": " << MessageLoader::getMessage(parms)
1149 << PEGASUS_STD(endl);
1150 #endif
|
1151 h.sterling 1.158 exit(1);
1152 }
|
1153 joyce.j 1.144 }
|
1154 kumpf 1.53 }
|
1155 kumpf 1.139 #if defined(PEGASUS_DEBUG)
|
1156 mike 1.32 // Put out startup up message.
|
1157 jim.wunderlich 1.180 cout << _cimServerProcess->getProductName() << " " << _cimServerProcess->getCompleteVersion() << endl;
|
1158 humberto 1.97 //l10n
1159 //cout << "Built " << __DATE__ << " " << __TIME__ << endl;
1160 //cout <<"Starting..."
1161 MessageLoaderParms parms("src.Server.cimserver.STARTUP_MESSAGE",
|
1162 h.sterling 1.153 "Built $0 $1\nStarting...",
1163 __DATE__,
1164 __TIME__);
|
1165 humberto 1.97 #endif
1166
1167 //l10n
1168 // reset message loading to NON-process locale
|
1169 david.dillard 1.165 MessageLoader::_useProcessLocale = false;
|
1170 humberto 1.97 //l10n
|
1171 mike 1.32
|
1172 kumpf 1.137 // Get the parent's PID before forking
|
1173 h.sterling 1.154 _cimServerProcess->set_parent_pid(System::getPID());
|
1174 david.dillard 1.165
|
1175 kumpf 1.63 // do we need to run as a daemon ?
1176 if (daemonOption)
1177 {
|
1178 h.sterling 1.153 if(-1 == _cimServerProcess->cimserver_fork())
|
1179 diane 1.81 #ifndef PEGASUS_OS_OS400
|
1180 h.sterling 1.153 {
1181 return(-1);
1182 }
|
1183 diane 1.81 #else
|
1184 h.sterling 1.153 {
|
1185 david 1.85 return(-1);
|
1186 h.sterling 1.153 }
1187 else
1188 {
1189 return(0);
1190 }
|
1191 diane 1.81 #endif
|
1192 david.dillard 1.165
|
1193 kumpf 1.63 }
|
1194 chuck 1.66
|
1195 chuck 1.96 // l10n
1196 // Now we are after the fork...
1197 // Create a dummy Thread object that can be used to store the
|
1198 kumpf 1.176 // AcceptLanguageList object for CIM requests that are serviced
|
1199 chuck 1.96 // by this thread (initial thread of server). Need to do this
1200 // because this thread is not in a ThreadPool, but is used
1201 // to service CIM requests.
1202 // The run function for the dummy Thread should never be called,
|
1203 konrad.r 1.166 dummyInitialThread = new Thread(dummyThreadFunc, NULL, false);
|
1204 david.dillard 1.165 Thread::setCurrent(dummyInitialThread);
|
1205 kumpf 1.176 AcceptLanguageList default_al;
|
1206 humberto 1.108 try{
|
1207 kumpf 1.174 default_al = LanguageParser::getDefaultAcceptLanguages();
|
1208 kumpf 1.176 Thread::setLanguages(new AcceptLanguageList(default_al));
|
1209 kumpf 1.122 }catch(InvalidAcceptLanguageHeader& e){
|
1210 h.sterling 1.153 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
1211 "src.Server.cimserver.FAILED_TO_SET_PROCESS_LOCALE",
|
1212 david.dillard 1.165 "Could not convert the system process locale into a valid AcceptLanguage format.");
|
1213 h.sterling 1.153 Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
|
1214 david.dillard 1.165 e.getMessage());
|
1215 humberto 1.108 }
|
1216 david.dillard 1.165
1217
|
1218 chuck 1.96
|
1219 chuck 1.66 #ifdef PEGASUS_OS_OS400
1220 // Special server initialization code for OS/400.
1221 if (cimserver_initialize() != 0)
1222 {
|
1223 h.sterling 1.153 // do some logging here!
1224 //l10n
1225 //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
|
1226 david.dillard 1.165 //"CIM Server failed to initialize");
|
1227 h.sterling 1.153 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
1228 "src.Server.cimserver.SERVER_FAILED_TO_INITIALIZE",
|
1229 david.dillard 1.165 "CIM Server failed to initialize");
|
1230 h.sterling 1.153 return(-1);
|
1231 david.dillard 1.165 }
|
1232 chuck 1.66 #endif
|
1233 chuck 1.96
|
1234 kumpf 1.167 #ifndef PEGASUS_OS_TYPE_WINDOWS
1235 umask(S_IRWXG|S_IRWXO);
1236 #endif
|
1237 mday 1.62
|
1238 mateus.baur 1.175
1239 #if defined(PEGASUS_OS_TYPE_UNIX)
1240 //
1241 // CRITICAL SECTION BEGIN
1242 //
1243 // This is the beginning of the critical section regarding the
1244 // access to pidfile (file to indicate that the cimserver has started).
1245 // Sometimes, when 2 or more cimserver processes are started at the same
1246 // time, they can't detect the concurrent process execution because the
1247 // logic fails when pidfile is accessed concurrently.
1248
1249 FILE *startupLockFile;
1250
|
1251 denise.eckstein 1.177 if ((startupLockFile = fopen(ConfigManager::getHomedPath(
1252 CIMSERVER_LOCK_FILE).getCString(), "w")) != 0)
|
1253 mateus.baur 1.175 {
1254 lockf(fileno(startupLockFile), F_LOCK, 0);
1255 }
1256 #endif
1257
|
1258 gs.keenan 1.150 #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) \
1259 || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) \
|
1260 jim.wunderlich 1.169 || defined(PEGASUS_OS_SOLARIS) || defined (PEGASUS_OS_VMS)
|
1261 kumpf 1.79
1262 //
1263 // check if CIMServer is already running
|
1264 david.dillard 1.165 // if CIMServer is already running, print message and
|
1265 kumpf 1.79 // notify parent process (if there is a parent process) to terminate
1266 //
|
1267 h.sterling 1.153 if(_cimServerProcess->isCIMServerRunning())
|
1268 kumpf 1.79 {
|
1269 h.sterling 1.153 //l10n
1270 //cout << "Unable to start CIMServer." << endl;
1271 //cout << "CIMServer is already running." << endl;
1272 MessageLoaderParms parms("src.Server.cimserver.UNABLE_TO_START_SERVER_ALREADY_RUNNING",
|
1273 thilo.boehm 1.192 "Unable to start CIMServer. CIMServer is already running.");
|
1274 h.sterling 1.153 PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);
|
1275 thilo.boehm 1.192 Logger::put(Logger::ERROR_LOG,System::CIMSERVER,Logger::INFORMATION,
1276 MessageLoader::getMessage(parms));
|
1277 kumpf 1.79
|
1278 h.sterling 1.153 //
|
1279 kumpf 1.79 // notify parent process (if there is a parent process) to terminate
1280 //
1281 if (daemonOption)
|
1282 h.sterling 1.153 _cimServerProcess->notify_parent(1);
|
1283 kumpf 1.79
|
1284 s.hills 1.117 return(1);
|
1285 kumpf 1.79 }
|
1286 david.dillard 1.165
|
1287 kumpf 1.63 #endif
|
1288 kumpf 1.51
|
1289 mike 1.32 // try loop to bind the address, and run the server
1290 try
1291 {
|
1292 mday 1.116
|
1293 konrad.r 1.163 _monitor = new Monitor();
|
1294 h.sterling 1.153 //PEP#222
1295 //CIMServer server(&monitor);
1296 //CimserverHolder cimserverHolder( &server );
|
1297 konrad.r 1.163 _cimServer = new CIMServer(_monitor);
|
1298 mday 1.111
|
1299 kumpf 1.41
|
1300 kumpf 1.86 if (enableHttpConnection)
1301 {
|
1302 sushma.fernandes 1.189 _cimServer->addAcceptor(false, portNumberHttp, false);
|
1303 humberto 1.97 //l10n
1304 //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
1305 //"Listening on HTTP port $0.", portNumberHttp);
|
1306 david.dillard 1.165
|
1307 humberto 1.97 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
|
1308 h.sterling 1.153 "src.Server.cimserver.LISTENING_ON_HTTP_PORT",
1309 "Listening on HTTP port $0.", portNumberHttp);
|
1310 kumpf 1.86 }
1311 if (enableHttpsConnection)
1312 {
|
1313 sushma.fernandes 1.189 _cimServer->addAcceptor(false, portNumberHttps, true);
|
1314 humberto 1.97 //l10n
1315 //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
1316 //"Listening on HTTPS port $0.", portNumberHttps);
1317 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
|
1318 h.sterling 1.153 "src.Server.cimserver.LISTENING_ON_HTTPS_PORT",
1319 "Listening on HTTPS port $0.", portNumberHttps);
|
1320 kumpf 1.86 }
|
1321 kumpf 1.135
|
1322 h.sterling 1.159 #ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
|
1323 sushma.fernandes 1.189 _cimServer->addAcceptor(true, 0, false);
|
1324 humberto 1.97 //l10n
1325 //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
1326 //"Listening on local connection socket.");
1327 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
|
1328 h.sterling 1.153 "src.Server.cimserver.LISTENING_ON_LOCAL",
1329 "Listening on local connection socket.");
|
1330 kumpf 1.41 #endif
|
1331 kumpf 1.86
|
1332 kumpf 1.139 #if defined(PEGASUS_DEBUG)
|
1333 kumpf 1.86 if (enableHttpConnection)
1334 {
|
1335 humberto 1.97 //l10n
1336 //cout << "Listening on HTTP port " << portNumberHttp << endl;
|
1337 h.sterling 1.153 MessageLoaderParms parms("src.Server.cimserver.LISTENING_ON_HTTP_PORT",
1338 "Listening on HTTP port $0.", portNumberHttp);
1339 cout << MessageLoader::getMessage(parms) << endl;
|
1340 kumpf 1.86 }
1341 if (enableHttpsConnection)
1342 {
|
1343 humberto 1.97 //l10n
1344 //cout << "Listening on HTTPS port " << portNumberHttps << endl;
|
1345 humberto 1.103 MessageLoaderParms parms("src.Server.cimserver.LISTENING_ON_HTTPS_PORT",
|
1346 h.sterling 1.153 "Listening on HTTPS port $0.", portNumberHttps);
1347 cout << MessageLoader::getMessage(parms) << endl;
|
1348 kumpf 1.86 }
|
1349 kumpf 1.135
|
1350 h.sterling 1.159 # ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
|
1351 humberto 1.97 //l10n
1352 //cout << "Listening on local connection socket" << endl;
1353 MessageLoaderParms parms("src.Server.cimserver.LISTENING_ON_LOCAL",
|
1354 h.sterling 1.153 "Listening on local connection socket.");
|
1355 humberto 1.97 cout << MessageLoader::getMessage(parms) << endl;
|
1356 kumpf 1.86 # endif
|
1357 david 1.85 #endif
|
1358 mike 1.35
|
1359 konrad.r 1.163 _cimServer->bind();
|
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 mateus.baur 1.175 #if defined(PEGASUS_OS_TYPE_UNIX)
1393 //
1394 // CRITICAL SECTION END
1395 //
1396 // Here is the unlock of file 'lock_file'. It closes the
1397 // the critical section that guarantees the non concurrent access to
1398 // pid file (file to indicate that the cimserver has started).
1399 //
1400
1401 if (startupLockFile)
1402 {
1403 lockf(fileno(startupLockFile), F_ULOCK, 0);
1404 fclose(startupLockFile);
1405 }
1406 #endif
1407
1408
|
1409 kumpf 1.54 // Put server started message to the logger
|
1410 kumpf 1.143 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER,
1411 Logger::INFORMATION,
1412 "src.Server.cimserver.STARTED_VERSION",
1413 "Started $0 version $1.",
|
1414 jim.wunderlich 1.180 _cimServerProcess->getProductName(), _cimServerProcess->getCompleteVersion());
|
1415 kumpf 1.45
|
1416 marek 1.190 #if defined(PEGASUS_OS_TYPE_UNIX) && !defined(PEGASUS_OS_ZOS)
|
1417 kumpf 1.178 if (daemonOption && !debugOutputOption)
1418 {
1419 // Direct standard input, output, and error to /dev/null,
1420 // since we are running as a daemon.
1421 close(0);
1422 open("/dev/null", O_RDONLY);
1423 close(1);
1424 open("/dev/null", O_RDWR);
1425 close(2);
1426 open("/dev/null", O_RDWR);
1427 }
1428 #endif
1429
|
1430 thilo.boehm 1.185 #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
1431
1432 // ARM is a z/OS internal restart facility.
1433 // This is a z/OS specific change.
1434
1435 // Instatiating the automatic restart manager for zOS
1436 ARM_zOS automaticRestartManager;
1437
1438 // register to zOS ARM
1439 automaticRestartManager.Register();
1440
1441 #endif
1442
1443
1444
|
1445 mike 1.35 //
1446 // Loop to call CIMServer's runForever() method until CIMServer
1447 // has been shutdown
1448 //
|
1449 h.sterling 1.153 while( !_cimServer->terminated() )
1450 {
|
1451 mday 1.116
|
1452 h.sterling 1.153 _cimServer->runForever();
|
1453 mday 1.112
|
1454 h.sterling 1.153 }
|
1455 carson.hovey 1.157
|
1456 kumpf 1.45 //
1457 // normal termination
|
1458 carson.hovey 1.157 //
|
1459 thilo.boehm 1.185 #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
1460
1461 // ARM is a z/OS internal restart facility.
1462 // This is a z/OS specific change.
1463
1464 // register to zOS ARM
1465 automaticRestartManager.DeRegister();
1466
1467 #endif
|
1468 kumpf 1.143
|
1469 kumpf 1.54 // Put server shutdown message to the logger
|
1470 kumpf 1.143 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER,
1471 Logger::INFORMATION, "src.Server.cimserver.STOPPED",
|
1472 h.sterling 1.153 "$0 stopped.", _cimServerProcess->getProductName());
|
1473 kumpf 1.45
|
1474 carolann.graves 1.171 #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) \
|
1475 gs.keenan 1.150 || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) \
|
1476 jim.wunderlich 1.169 || defined(PEGASUS_OS_SOLARIS) || defined(PEGASUS_OS_VMS)
|
1477 kumpf 1.45 //
|
1478 carolann.graves 1.171 // Note: do not remove the PID file created at startup time, since
1479 // shutdown is not complete until the CIMServer destructor completes.
|
1480 kumpf 1.45 //
1481 #endif
|
1482 mike 1.32 }
|
1483 marek 1.195 catch(BindFailedException& e)
|
1484 mike 1.32 {
|
1485 marek 1.194 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
1486 "src.Server.cimserver.SERVER_NOT_STARTED",
1487 "cimserver not started: $0", e.getMessage());
|
1488 david 1.100
|
1489 marek 1.194 #if !defined(PEGASUS_OS_OS400)
1490 MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED",
1491 "cimserver not started: $0", e.getMessage());
|
1492 david 1.100
|
1493 marek 1.194 cerr << MessageLoader::getMessage(parms) << endl;
|
1494 david 1.85 #endif
|
1495 kumpf 1.77
|
1496 h.sterling 1.153 //
|
1497 kumpf 1.77 // notify parent process (if there is a parent process) to terminate
1498 //
1499 if (daemonOption)
|
1500 h.sterling 1.153 _cimServerProcess->notify_parent(1);
|
1501 kumpf 1.77
|
1502 h.sterling 1.156 deleteCIMServer();
|
1503 kumpf 1.54 return 1;
|
1504 mike 1.32 }
|
1505 marek 1.195 catch(Exception& e)
1506 {
1507 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
1508 "src.Server.cimserver.ERROR",
1509 "Error: $0", e.getMessage());
1510 #ifndef PEGASUS_OS_OS400
1511 MessageLoaderParms parms("src.Server.cimserver.ERROR",
1512 "Error: $0", e.getMessage());
1513 PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);
1514 #endif
1515 //
1516 // notify parent process (if there is a parent process) to terminate
1517 //
1518 if (daemonOption)
1519 _cimServerProcess->notify_parent(1);
1520
1521 deleteCIMServer();
1522 return 1;
1523 }
|
1524 mike 1.32
|
1525 h.sterling 1.156 deleteCIMServer();
|
1526 mike 1.32 return 0;
1527 }
|
1528 tony 1.128
1529
1530
1531
|