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