-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetup.py
216 lines (154 loc) · 5.12 KB
/
Setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
import imp
import threading
import fetcher
import Debug
import telegramclient
import time
import notifier
import logging
import Blocknotifier
import Blockchain
import signal,sys
import dbrunning
import dbhistorywrite
import dbhistoricrunning
import config
import swtoprunning,swthourmodule
import clearolddbstring
import checkblock
for handler in logging.root.handlers[:]:
logging.root.removeHandler(handler)
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s - %(threadName)-12.12s',level=logging.INFO)
logging.getLogger().addHandler(logging.StreamHandler())
debug = False
running = True
runningdebug = True
debugtelegram = True
interval = config.refreshinterval
chatid = config.chatid
chatiddev = config.chatiddev
setuptoken = config.token
if __name__ == "__main__":
global x1
# creating thread
t1 = threading.Thread(target=fetcher.connect, args=(debug,running,interval))
logging.info("Setting Thread Fetcher")
t2 = threading.Thread(target=Debug.start, args=(runningdebug,interval))
logging.debug("Setting Thread Debug Module")
t3 = threading.Thread(target=telegramclient.main,)
logging.debug("Setting Thread Telegramclient")
t4 = threading.Thread(target=dbrunning.main, args=(interval,debug))
logging.debug("Setting Thread Notifier")
#t5 = threading.Thread(target=Blocknotifier.blockchecker, args=(interval,debug))
logging.debug("Setting Thread Blocknotifier")
t6 = threading.Thread(target=Blockchain.blockchain, args=(debug,running,interval))
logging.debug("Setting Thread Blockchain")
t7 = threading.Thread(target=dbhistoricrunning.main, args=(interval,debug))
logging.debug("Setting History module")
t8 = threading.Thread(target=swtoprunning.main)
logging.debug("Setting top module")
t9 = threading.Thread(target=swthourmodule.main)
logging.debug("Setting hourly module")
t10 = threading.Thread(target=dbhistorywrite.main, args=(interval,debug))
logging.debug("Setting history module")
t11 = threading.Thread(target=clearolddbstring.deleteoldstring, args=(interval,debug))
logging.debug("Setting ClearDB module")
t12 = threading.Thread(target=checkblock.check)
logging.debug("Setting ClearDB module")
#------
t1.start()
logging.info("Starting Thread Fetcher")
#time.sleep(2)
t2.start()
logging.debug("Starting Debug Node")
#time.sleep(2)
t3.start()
logging.debug("Starting Thread Telegram Client")
#time.sleep(2)
t4.start()
logging.debug("Starting Thread DBRunning")
#t5.start()
#print "Starting blocknotifier"
#logging.debug("Starting Thread Blocknotifier")
t6.start()
logging.debug("Starting Thread Blockchain")
t7.start()
logging.debug("Starting HistoryMain")
t8.start()
logging.debug("Starting top module")
t9.start()
logging.debug("Starting hourly module")
t10.start()
logging.debug("Starting History module")
t11.start()
logging.debug("Starting ClearDB module")
t12.start()
logging.debug("Starting Checkblock module")
x1 = t1.is_alive()
logging.info(x1)
x2 = t2.is_alive()
logging.info(x2)
x3 = t3.is_alive()
logging.info(x3)
x4 = t4.is_alive()
logging.info(x4)
x6 = t6.is_alive()
logging.info(x6)
x7 = t7.is_alive()
logging.info(x7)
x8 = t8.is_alive()
logging.info(x8)
x9 = t9.is_alive()
logging.info(x9)
x10 = t10.is_alive()
logging.info(x10)
x11 = t11.is_alive()
logging.info(x11)
x12 = t12.is_alive()
logging.info(x12)
while True:
telegramclient.x1 = x1
telegramclient.x2 = x2
telegramclient.x3 = x3
telegramclient.x4 = x4
telegramclient.x6 = x6
telegramclient.x7 = x7
telegramclient.x8 = x8
telegramclient.x9 = x9
telegramclient.x10 = x10
telegramclient.x11 = x11
telegramclient.x12 = x12
time.sleep(100)
if x1 == False:
telegramclient.module_error("Module 1")
t1.start()
if x2 == False:
telegramclient.module_error("Module 2")
t2.start()
if x3 == False:
telegramclient.module_error("Module 3")
t3.start()
if x4 == False:
telegramclient.module_error("Module 4")
t4.start()
if x6 == False:
telegramclient.module_error("Module 6")
t6.start()
if x7 == False:
telegramclient.module_error("Module 7")
t7.start()
if x8 == False:
telegramclient.module_error("Module 8")
t8.start()
if x9 == False:
telegramclient.module_error("Module 9")
t9.start()
if x10 == False:
telegramclient.module_error("Module 10")
t10.start()
if x11 == False:
telegramclient.module_error("Module 11")
t11.start()
if x12 == False:
telegramclient.module_error("Module 12")
t12.start()