1 mike 1.32 //%/////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to
7 // deal in the Software without restriction, including without limitation the
8 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 // sell copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
13 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
14 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
16 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
18 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
19 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 //
21 //==============================================================================
22 mike 1.32 //
23 // Author: Mike Brasher (mbrasher@bmc.com)
24 //
25 // Modified By: Mike Day (mdday@us.ibm.com)
|
26 mike 1.33 //
|
27 mike 1.32 // Modified By: Karl Schopmeyer (k.schopmeyer@opengroup.org)
28 //
|
29 mike 1.35 // Modified By: Nag Boranna (nagaraja_boranna@hp.com)
30 //
31 // Modified By: Jenny Yu (jenny_yu@hp.com)
32 //
|
33 kumpf 1.38 // Modified By: Sushma Fernandes (sushma_fernandes@hp.com)
34 //
|
35 mike 1.32 //%/////////////////////////////////////////////////////////////////////////////
36
37
38 //////////////////////////////////////////////////////////////////////
39 //
40 // Notes on deamon operation (Unix) and service operation (Win 32):
41 //
42 // To run pegasus as a daemon on Unix platforms, use the -d option:
43 //
44 // cimserver -d
45 //
46 // The -d option has no effect on windows operation.
47 //
|
48 mike 1.35 // To shutdown pegasus, use the -s option:
49 //
50 // cimserver -s [-f] [-T timeout_value]
51 //
|
52 mike 1.32 // To run pegasus as an NT service, there are FOUR different possibilities:
53 //
54 // To INSTALL the Pegasus service,
55 //
56 // cimserver -install
57 //
58 // To REMOVE the Pegasus service,
59 //
60 // cimserver -remove
61 //
62 // To START the Pegasus service,
63 //
64 // net start cimserver
65 //
66 // To STOP the Pegasus service,
67 //
68 // net stop cimserver
69 //
70 // Alternatively, you can use the windows service manager. Pegasus shows up
71 // in the service database as "Pegasus CIM Object Manager"
72 //
73 mike 1.32 // Mike Day, mdday@us.ibm.com
74 //
75 //////////////////////////////////////////////////////////////////////
76
77
|
78 mike 1.35 #include <Pegasus/Common/Config.h>
|
79 mike 1.32 #include <iostream>
|
80 mike 1.35 #include <cassert>
|
81 mike 1.32 #include <cstdlib>
82 #include <Pegasus/Common/FileSystem.h>
|
83 mike 1.35 #include <Pegasus/Common/Monitor.h>
|
84 mike 1.32 #include <Pegasus/Server/CIMServer.h>
85 #include <Pegasus/Common/PegasusVersion.h>
86 #include <Pegasus/Common/Logger.h>
87 #include <Pegasus/Common/System.h>
|
88 mike 1.35 #include <Pegasus/Common/Tracer.h>
89 #include <Pegasus/Config/ConfigManager.h>
90 #include <Pegasus/Client/CIMClient.h>
91 #include <Pegasus/Server/ShutdownService.h>
|
92 kumpf 1.38 #include <Pegasus/Common/Destroyer.h>
|
93 kumpf 1.44 #if !defined(PEGASUS_OS_ZOS) && ! defined(PEGASUS_OS_HPUX)
|
94 mike 1.32 #include <slp/slp.h>
|
95 mike 1.35 #endif
|
96 mike 1.32
97
98 #if defined(PEGASUS_OS_TYPE_WINDOWS)
99 # include "cimserver_windows.cpp"
100 #elif defined(PEGASUS_OS_TYPE_UNIX)
101 # include "cimserver_unix.cpp"
102 #else
103 # error "Unsupported platform"
104 #endif
105
106 PEGASUS_USING_PEGASUS;
107 PEGASUS_USING_STD;
108
|
109 mike 1.35 //
110 // The command name.
111 //
112 static const char COMMAND_NAME [] = "cimserver";
113
114 //
115 // The constant defining usage string.
116 //
117 static const char USAGE [] = "Usage: ";
118
119 /**
120 Constants representing the command line options.
121 */
122 static const char OPTION_VERSION = 'v';
123
124 static const char OPTION_HELP = 'h';
125
126 static const char OPTION_HOME = 'D';
127
128 static const char OPTION_SHUTDOWN = 's';
129
130 mike 1.35 static const char OPTION_FORCE = 'f';
131
132 static const char OPTION_TIMEOUT = 'T';
133
|
134 kumpf 1.43 static const String NAMESPACE = "root/PG_Internal";
|
135 mike 1.35 static const String CLASSNAME_SHUTDOWNSERVICE = "PG_ShutdownService";
|
136 kumpf 1.36 static const String PROPERTY_TIMEOUT = "operationTimeout";
|
137 mike 1.35
138 ConfigManager* configManager;
139
|
140 mike 1.32 /** GetOptions function - This function defines the Options Table
|
141 mike 1.35 and sets up the options from that table using the config manager.
|
142 mike 1.32 */
143 void GetOptions(
|
144 mike 1.35 ConfigManager* cm,
|
145 mike 1.32 int& argc,
146 char** argv,
147 const String& pegasusHome)
148 {
|
149 mike 1.35 try
|
150 mike 1.32 {
|
151 kumpf 1.38 cm->mergeConfigFiles();
|
152 mike 1.33
|
153 mike 1.35 cm->mergeCommandLine(argc, argv);
154 }
155 catch (NoSuchFile nsf)
156 {
157 throw nsf;
158 }
159 catch (FileNotReadable fnr)
160 {
161 throw fnr;
162 }
163 catch (CannotRenameFile ftrf)
164 {
165 throw ftrf;
166 }
167 catch (ConfigFileSyntaxError cfse)
168 {
169 throw cfse;
170 }
171 catch(UnrecognizedConfigProperty ucp)
172 {
173 throw ucp;
174 mike 1.35 }
175 catch(InvalidPropertyValue ipv)
176 {
177 throw ipv;
178 }
|
179 mike 1.32 }
180
181 /* PrintHelp - This is temporary until we expand the options manager to allow
182 options help to be defined with the OptionRow entries and presented from
183 those entries.
184 */
185 void PrintHelp(const char* arg0)
186 {
|
187 mike 1.35 /**
188 Build the usage string for the config command.
189 */
190 String usage = String (USAGE);
191 usage.append (COMMAND_NAME);
192 usage.append (" [ [ options ] | [ configProperty=value, ... ] ]\n");
193 usage.append (" options\n");
194 usage.append (" -v - displays pegasus version number\n");
195 usage.append (" -h - prints this help message\n");
196 usage.append (" -D [home] - sets pegasus home directory\n");
197 usage.append (" -t - turns tracing on\n");
198 usage.append (" -t - turns on trace of client IO to console\n");
199 usage.append (" -l - turns on trace of client IO to trace file\n");
200 usage.append (" -d - runs pegasus as a daemon\n");
201 usage.append (" -s [-f] [-T timeout] \n");
202 usage.append (" - shuts down pegasus\n");
203 usage.append (" -cleanlogs - clears the log files at startup\n");
204 usage.append (" -install - installs pegasus as a Windows NT Service\n");
205 usage.append (" -remove - removes pegasus as a Windows NT Service\n");
206 usage.append (" -slp - registers pegasus as a service with SLP\n\n");
207 usage.append (" -SSL - uses SSL\n\n");
208 mike 1.35
209 usage.append (" configProperty=value\n");
210 usage.append (" port=nnnn - sets port number to listen on\n");
211 usage.append (" logdir=/pegasus/logs - directory for log files\n");
212
213 cout << endl;
|
214 mike 1.32 cout << PEGASUS_NAME << PEGASUS_VERSION << endl;
215 cout << endl;
|
216 mike 1.35 cout << usage << endl;
217 }
218
|
219 kumpf 1.36 void shutdownCIMOM(Boolean forceOption, Uint32 timeoutValue)
|
220 mike 1.35 {
221 //
222 // Create CIMClient object
223 //
|
224 kumpf 1.42 CIMClient client;
|
225 mike 1.35
226 //
227 // Get the port number
228 //
229 String portNumberStr = configManager->getCurrentValue("port");
230
231 String hostStr = System::getHostName();
232 hostStr.append(":");
233 hostStr.append(portNumberStr);
234
|
235 kumpf 1.36 // Put server shutdown message to the logger
236 Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
237 "Shutdown $0 on port $1.", PEGASUS_NAME, portNumberStr);
238
|
239 mike 1.35 //
240 // open connection to CIMOM
241 //
242 try
243 {
|
244 kumpf 1.43 client.connectLocal();
|
245 mike 1.35 }
|
246 kumpf 1.43 catch(CIMClientException& e)
|
247 mike 1.35 {
|
248 kumpf 1.36 Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
249 "Failed to connect to $0 $1.", PEGASUS_NAME, e.getMessage());
250
|
251 mike 1.35 PEGASUS_STD(cerr) << "Failed to connect to server: " << e.getMessage() << PEGASUS_STD(endl);
252 exit(1);
253 }
254
255 try
256 {
257 //
258 // construct CIMReference
259 //
260 String referenceStr = "//";
261 referenceStr.append(hostStr);
262 referenceStr.append("/root/cimv2:PG_ShutdownService");
263 CIMReference reference(referenceStr);
264
265 //
266 // issue the invokeMethod request on the shutdown method
267 //
268 Array<CIMParamValue> inParams;
269 Array<CIMParamValue> outParams;
270
|
271 kumpf 1.40 inParams.append(CIMParamValue("force",
|
272 kumpf 1.39 CIMValue(Boolean(forceOption))));
|
273 mike 1.35
|
274 kumpf 1.40 inParams.append(CIMParamValue("timeout",
|
275 kumpf 1.39 CIMValue(Uint32(timeoutValue))));
|
276 mike 1.35
277 CIMValue retValue = client.invokeMethod(
278 NAMESPACE,
279 reference,
280 "shutdown",
281 inParams,
282 outParams);
|
283 kumpf 1.36
284 // Put server shutdown message to the logger
285 Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
286 "$0 terminated on port $1.", PEGASUS_NAME, portNumberStr);
287
|
288 kumpf 1.43 }
289 catch(CIMClientCIMException& e)
290 {
291 PEGASUS_STD(cerr) << "Failed to shutdown server: " << e.getMessage() << PEGASUS_STD(endl);
292 exit(1);
293 }
294 catch(CIMClientException& e)
295 {
296 // this may mean the cimserver has been terminated
|
297 mike 1.35 }
298 catch(Exception& e)
299 {
300 PEGASUS_STD(cerr) << "Failed to shutdown server: " << e.getMessage() << PEGASUS_STD(endl);
301 exit(1);
302 }
303
304 return;
|
305 mike 1.32 }
306
|
307 mike 1.35
|
308 mike 1.33 /////////////////////////////////////////////////////////////////////////
|
309 mike 1.32 // MAIN
310 //////////////////////////////////////////////////////////////////////////
311 int main(int argc, char** argv)
312 {
|
313 mike 1.35 String pegasusHome = String::EMPTY;
314 Boolean pegasusIOTrace = false;
315 Boolean pegasusIOLog = false;
316 String portOption = String::EMPTY;
317 String logsDirectory = String::EMPTY;
318 Boolean useSLP = false;
319 Boolean useSSL = false;
320 Boolean daemonOption = false;
321 Boolean shutdownOption = false;
322 Boolean forceOption = false;
323 Boolean timeoutOption = false;
324 String timeoutStr = String::EMPTY;
325 long timeoutValue = 0;
326
|
327 kumpf 1.38 //
328 // Get environment variables:
329 //
330 const char* tmp = getenv("PEGASUS_HOME");
331
332 if (tmp)
333 {
334 pegasusHome = tmp;
335 }
336
337 FileSystem::translateSlashes(pegasusHome);
338
|
339 mike 1.32 // on Windows NT if there are no command-line options, run as a service
340
341 if (argc == 1 )
|
342 mike 1.35 {
343 cim_server_service(argc, argv);
344 }
345 else
346 {
347 // Get help, version and home options
348
349 for (int i = 1; i < argc; )
350 {
351 const char* arg = argv[i];
352
353 // Check for -option
354 if (*arg == '-')
355 {
356 // Get the option
357 const char* option = arg + 1;
358
359 //
360 // Check to see if user asked for the version (-v option):
361 //
362 if (*option == OPTION_VERSION)
363 mike 1.35 {
364 cout << PEGASUS_VERSION << endl;
365 exit(0);
366 }
367 //
368 // Check to see if user asked for help (-h option):
369 //
370 else if (*option == OPTION_HELP)
371 {
372 PrintHelp(argv[0]);
373 exit(0);
374 }
375 else if (*option == OPTION_HOME)
376 {
377 if (i + 1 < argc)
378 {
379 pegasusHome.assign(argv[i + 1]);
380 }
381 else
382 {
383 cout << "Missing argument for option -" << option << endl;
384 mike 1.35 exit(0);
385 }
386
387 memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));
388 argc -= 2;
389 }
390 //
391 // Check to see if user asked for shutdown (-s option):
392 //
393 else if (*option == OPTION_SHUTDOWN)
394 {
395 //
396 // Check to see if shutdown has already been specified:
397 //
398 if (shutdownOption)
399 {
400 cout << "Duplicate shutdown option specified." << endl;
401 exit(0);
402 }
403 shutdownOption = true;
404
405 mike 1.35 // remove the option from the command line
406 memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
407 argc--;
408 }
409 else if (*option == OPTION_FORCE)
410 {
411 //
412 // Check to see if shutdown has been specified:
413 //
414 if (!shutdownOption)
415 {
416 cout << "Invalid option -" << option << endl;
417 exit(0);
418 }
419
420 //
421 // Check to see if force has already been specified:
422 //
423 if (forceOption)
424 {
425 cout << "Duplicate force option specified." << endl;
426 mike 1.35 exit(0);
427 }
428
429 forceOption = true;
430
431 // remove the option from the command line
432 memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
433 argc--;
434 }
435 else if (*option == OPTION_TIMEOUT)
436 {
437 //
438 // Check to see if shutdown has been specified:
439 //
440 if (!shutdownOption)
441 {
442 cout << "Invalid option -" << option << endl;
443 exit(0);
444 }
445
446 if (timeoutOption)
447 mike 1.35 {
448 cout << "Duplicate timeout option specified." << endl;
449 exit(0);
450 }
451
452 timeoutOption = true;
453
454 if (i + 1 < argc)
455 {
456 // get timeout value
457 timeoutStr.assign(argv[i + 1]);
458
459 // validate timeout value string
460 char* tmp = timeoutStr.allocateCString();
461 char* end = 0;
462 timeoutValue = strtol(tmp, &end, 10);
463
464 if (!end || *end != '\0')
465 {
466 cout << "invalid timeout value specified: ";
467 cout << timeoutStr << endl;
468 mike 1.35 delete [] tmp;
469 exit(0);
470 }
471 }
472 else
473 {
474 cout << "Missing argument for option -";
475 cout << option << endl;
476 exit(0);
477 }
478
479 // remove the option from the command line
480 memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));
481 argc -= 2;
482 }
483 else
484 i++;
485 }
486 else
487 i++;
|
488 mike 1.32 }
489 }
|
490 mike 1.35
|
491 kumpf 1.38 //
492 // Set the value for pegasusHome property
493 //
494 ConfigManager::setPegasusHome(pegasusHome);
|
495 mike 1.32
|
496 mike 1.35 //
497 // Get an instance of the Config Manager.
498 //
499 configManager = ConfigManager::getInstance();
500
501 //
|
502 mike 1.32 // Get options (from command line and from configuration file); this
|
503 mike 1.35 // removes corresponding options and their arguments from the command
|
504 mike 1.32 // line.
|
505 mike 1.35 //
|
506 mike 1.32 try
507 {
|
508 mike 1.35 GetOptions(configManager, argc, argv, pegasusHome);
|
509 mike 1.32 }
510 catch (Exception& e)
511 {
|
512 mike 1.35 cerr << argv[0] << ": " << e.getMessage() << endl;
513 exit(1);
|
514 mike 1.32 }
515
516
|
517 mike 1.35 try
|
518 mike 1.32 {
|
519 mike 1.35 //
520 // Check to see if we should (can) install as a NT service
521 //
522
523 if (String::equal(configManager->getCurrentValue("install"), "true"))
524 {
525 if( 0 != cimserver_install_nt_service( pegasusHome ))
526 {
527 cout << "\nPegasus installed as NT Service";
528 exit(0);
529 }
530 }
|
531 mike 1.32
|
532 mike 1.35 //
533 // Check to see if we should (can) remove Pegasus as an NT service
534 //
535
536 if (String::equal(configManager->getCurrentValue("remove"), "true"))
537 {
538 if( 0 != cimserver_remove_nt_service() )
539 {
540 cout << "\nPegasus removed as NT Service";
541 exit(0);
542 }
543 }
|
544 mike 1.32
|
545 mike 1.35 //
546 // Check to see if we should Pegasus as a daemon
547 //
548
549 if (String::equal(configManager->getCurrentValue("daemon"), "true"))
550 {
551 daemonOption = true;
552 }
|
553 mike 1.32
|
554 mike 1.35 //
|
555 kumpf 1.36 // Check the log trace options and set global variable
556 //
557
558 if (String::equal(configManager->getCurrentValue("logtrace"), "true"))
559 {
560 pegasusIOLog = true;
561 }
562
563 // Get the log file directory definition.
564 // We put String into Cstring because
565 // Directory functions only handle Cstring.
566 // ATTN-KS: create String based directory functions.
567
568 logsDirectory = configManager->getCurrentValue("logdir");
|
569 kumpf 1.38 logsDirectory =
570 ConfigManager::getHomedPath(configManager->getCurrentValue("logdir"));
|
571 kumpf 1.36
572 // Set up the Logger. This does not open the logs
573 // Might be more logical to clean before set.
574 // ATTN: Need tool to completely disable logging.
575
576 Logger::setHomeDirectory(logsDirectory);
577
578 //
|
579 mike 1.35 // Check to see if we need to shutdown CIMOM
580 //
581 if (shutdownOption)
582 {
583 //
584 // if timeout was specified, validate the timeout value
585 //
586 if (timeoutOption)
587 {
588 Boolean valid = configManager->validatePropertyValue(
589 PROPERTY_TIMEOUT,
590 timeoutStr);
591 if (!valid)
592 {
593 cout << "Invalid timeout value specified: " << timeoutValue;
594 cout << endl;
595 exit(1);
596 }
597 }
598
|
599 kumpf 1.36 shutdownCIMOM(forceOption, timeoutValue);
|
600 mike 1.35 cout << "Pegasus CIM Server terminated." << endl;
601 exit(0);
602 }
|
603 mike 1.32
|
604 mike 1.35 //
605 // Grab the port option:
606 //
607
608 portOption = configManager->getCurrentValue("port");
609
610 //
611 // Check the trace options and set global variable
612 //
613
614 if (String::equal(configManager->getCurrentValue("trace"), "true"))
615 {
616 pegasusIOTrace = true;
617 cout << "Trace Set" << endl;
618 }
619
|
620 kumpf 1.36 // Leave this in until people get familiar with the logs.
621 cout << "Logs Directory = " << logsDirectory << endl;
|
622 mike 1.35
623 if (String::equal(configManager->getCurrentValue("cleanlogs"), "true"))
624 {
625 Logger::clean(logsDirectory);;
626 }
|
627 mike 1.32
|
628 mike 1.35 if (String::equal(configManager->getCurrentValue("slp"), "true"))
629 {
630 useSLP = true;
631 }
|
632 mike 1.32
|
633 mike 1.35 if (String::equal(configManager->getCurrentValue("SSL"), "true"))
634 {
635 useSSL = true;
636 }
|
637 mike 1.32 }
|
638 mike 1.35 catch (UnrecognizedConfigProperty e)
|
639 mike 1.32 {
|
640 mike 1.35 cout << "Error: " << e.getMessage() << endl;
|
641 mike 1.32 }
642
643 char* address = portOption.allocateCString();
644
645 // Put out startup up message.
646 cout << PEGASUS_NAME << PEGASUS_VERSION <<
647 " on port " << address << endl;
648 cout << "Built " << __DATE__ << " " << __TIME__ << endl;
649 cout <<"Started..."
650 << (pegasusIOTrace ? " Tracing to Display ": " ")
651 << (pegasusIOLog ? " Tracing to Log ": " ")
652 << (useSLP ? " SLP reg. " : " No SLP ")
|
653 mike 1.35 << (useSSL ? " Use SSL " : " No SSL ")
|
654 mike 1.32 << endl;
655
656 // Put server start message to the logger
657 Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
|
658 mike 1.35 "Start $0 $1 port $2 $3 $4 $5",
|
659 mike 1.32 PEGASUS_NAME,
660 PEGASUS_VERSION,
661 address,
662 (pegasusIOTrace ? " Tracing": " "),
|
663 mike 1.35 (useSLP ? " SLP on " : " SLP off "),
664 (useSSL ? " Use SSL " : " No SSL "));
|
665 mike 1.32
|
666 mike 1.35 // do we need to run as a daemon ?
667 if (daemonOption)
668 {
669 if(-1 == cimserver_fork())
670 exit(-1);
671 }
|
672 mike 1.32
673 // try loop to bind the address, and run the server
674 try
675 {
|
676 kumpf 1.44 #if !defined(PEGASUS_OS_ZOS) && ! defined(PEGASUS_OS_HPUX)
|
677 mike 1.32 slp_client *discovery = new slp_client() ;;
678 String serviceURL;
679 serviceURL.assign("service:cim.pegasus://");
680 String host_name = slp_get_host_name();
681 serviceURL += host_name;
682 serviceURL += ":";
683 serviceURL += address;
684 char *url = serviceURL.allocateCString();
685 // free(host_name);
|
686 mike 1.35 #endif
|
687 mike 1.32
|
688 mike 1.35 Monitor monitor;
|
689 kumpf 1.38 CIMServer server(&monitor, useSSL);
|
690 kumpf 1.41
691 // bind throws an exception if the bind fails
692 #ifdef PEGASUS_LOCAL_DOMAIN_SOCKET
693 cout << "Binding to domain socket" << endl;
694 #else
|
695 mike 1.33 cout << "Binding to " << address << endl;
|
696 kumpf 1.41 #endif
|
697 mike 1.35
698 char* end = 0;
699 long portNumber = strtol(address, &end, 10);
700 assert(end != 0 && *end == '\0');
701 server.bind(portNumber);
702
|
703 mike 1.32 delete [] address;
704
705 time_t last = 0;
|
706 mike 1.35
707 //
708 // Loop to call CIMServer's runForever() method until CIMServer
709 // has been shutdown
710 //
711 while( !server.terminated() )
|
712 mike 1.32 {
|
713 kumpf 1.44 #if !defined(PEGASUS_OS_ZOS) && ! defined(PEGASUS_OS_HPUX)
|
714 mike 1.32 if(useSLP )
715 {
716 if( (time(NULL) - last ) > 60 )
717 {
718 if( discovery != NULL && url != NULL )
719 discovery->srv_reg_all(url,
|
720 mike 1.35 "(namespace=root/cimv2)",
|
721 mike 1.32 "service:cim.pegasus",
722 "DEFAULT",
723 70) ;
724 time(&last);
725 }
726
727 discovery->service_listener();
728 }
|
729 mike 1.35 #endif
|
730 mike 1.32 server.runForever();
731 }
732
|
733 mike 1.34 // This statement is unrechable!
734 //
735 // Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
736 // "Normal Termination");
|
737 mike 1.32 }
738 catch(Exception& e)
739 {
740 Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
741 "Abnormal Termination $0", e.getMessage());
742
743 PEGASUS_STD(cerr) << "Error: " << e.getMessage() << PEGASUS_STD(endl);
744 }
745
746 return 0;
747 }
|