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