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