-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstartStatus.py
More file actions
61 lines (45 loc) · 1.49 KB
/
startStatus.py
File metadata and controls
61 lines (45 loc) · 1.49 KB
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
import libtmux, time
START_DIR = "~/scr.status_display"
class Window():
def __init__(self, name, command, start_dir = START_DIR):
self.name = name
self.command = command
self.start_dir = start_dir
def create(self, session):
print(self.name + " started")
window = session.new_window(attach = False,
window_name = self.name,
start_directory = self.start_dir)
pane = window.split_window(attach = False)
pane.send_keys(self.command)
'''
------------------------------------
'''
SESSION_NAME = "Status"
WINDOWS = [Window("client_cos", "python Clients/COS_Client.py"),
Window("client_hvac", "python Clients/HVAC_Client.py"),
Window("client_tof", "python Clients/TOF_Client.py"),
Window("client_power", "python Clients/Power_Client.py"),
Window("client_weather", "python Clients/Weather_Client.py"),
]
'''
------------------------------------
'''
if __name__ == "__main__":
server = libtmux.Server()
try:
session = server.find_where({"session_name": SESSION_NAME})
session.kill_session()
print("Session '" + SESSION_NAME + "' already exists, deleting...")
except:
pass
session = server.new_session(attach = False,
session_name = SESSION_NAME,
)
display = Window("display", "python Status_v4.py")
display.create(session)
# Display Server must start before running client scripts
time.sleep(10)
for w in WINDOWS:
w.create(session)
print("Services started on tmux session '" + SESSION_NAME + "'")