forked from performance21-p216/eges
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkill.py
More file actions
50 lines (32 loc) · 817 Bytes
/
kill.py
File metadata and controls
50 lines (32 loc) · 817 Bytes
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
import subprocess, json, glob
import time
import os.path
import configparser
config_file_name = 'config.json'
#!! No trailing /
code_path = None
accounts = []
bootstrap_accounts = []
#default values
config = None
machines = []
def prepare():
for machine in machines:
print("Killing machine: %s" % machine)
cmd = ["ssh", "%s" % machine, "pkill geth; pkill -9 geth "]
print(cmd)
subprocess.run(cmd)
def parse_config():
global config
config = json.load(open(config_file_name))
global machines
for i in range(len(config['cluster'])):
machines.append(config['cluster'][i]['ip'])
print(machines)
global code_path
code_path = config['code_path']
def main():
parse_config()
prepare()
if __name__ == "__main__":
main()