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