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