/[LeafOK_CVS]/innwebd/service.cpp
ViewVC logotype

Annotation of /innwebd/service.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations)
Tue Feb 8 05:54:13 2005 UTC (21 years, 1 month ago) by sysadm
Branch: MAIN
Changes since 1.6: +3 -0 lines
Content type: text/x-c++src
Set status of main service to stop if CONTROLD failed

1 sysadm 1.1 /*******************************************************/
2     /* */
3 sysadm 1.3 /* LeafOK Innbbsd */
4 sysadm 1.1 /* Copyright (C) LeafOK.com, 2003-2004 */
5     /* */
6     /* Programmed by Leaf */
7 sysadm 1.3 /* E-mail:leaflet@leafok.com QQ:6049044 */
8 sysadm 1.1 /* */
9     /* http://bbs.leafok.com */
10     /* http://bbs.leafok.net */
11     /* http://bbs.fenglin.info */
12     /* */
13     /*******************************************************/
14    
15     #include "StdAfx.h"
16     #include ".\service.h"
17 sysadm 1.3 #include ".\App_common.h"
18 sysadm 1.1
19     using namespace std;
20    
21     service::service(void)
22 sysadm 1.3 :CNTService(App_common::ServiceName)
23 sysadm 1.1 {
24 sysadm 1.3 this->m_iMajorVersion = App_common::Ver_Major;
25     this->m_iMinorVersion = App_common::Ver_Minor;
26 sysadm 1.1 }
27    
28     service::~service(void)
29     {
30     }
31    
32     void service::Run()
33     {
34 sysadm 1.6 int startup_err_count = 0;
35    
36 sysadm 1.1 this->ctrld.StartupDelay();
37    
38 sysadm 1.2 this->ctrld.InitThreadPool();
39    
40 sysadm 1.5 while (this->m_bIsRunning)
41 sysadm 1.1 {
42 sysadm 1.6 if (this->ctrld.begin() == 0)
43 sysadm 1.3 {
44 sysadm 1.5 syslog << logfile::log_head << "Begin CONTROLD ... OK" << endl;
45 sysadm 1.3
46 sysadm 1.5 this->ctrld.StartupChild();
47    
48     break;
49     }
50     syslog << logfile::log_head << "Begin CONTROLD ... Failed" << endl;
51 sysadm 1.6
52     if (startup_err_count++ > 5)
53 sysadm 1.7 {
54     this->m_bIsRunning = false;
55 sysadm 1.6 break;
56 sysadm 1.7 }
57 sysadm 1.6
58     Sleep(1000 * 60 * 5);
59 sysadm 1.1 }
60 sysadm 1.5
61     while (this->m_bIsRunning && this->ctrld.IsRunning())
62 sysadm 1.1 {
63 sysadm 1.5 Sleep(100);
64     }
65    
66     this->ctrld.ShutdownChild();
67 sysadm 1.1
68     if (this->ctrld.end() == 0)
69     {
70 sysadm 1.3 syslog << logfile::log_head << "End CONTROLD ... OK" << endl;
71 sysadm 1.1 }
72     else
73     {
74 sysadm 1.3 syslog << logfile::log_head << "End CONTROLD ... Failed" << endl;
75 sysadm 1.1 }
76 sysadm 1.2
77     this->ctrld.CleanupThreadPool();
78 sysadm 1.1 }

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1