def start_client(ips): client_host = ParallelSSHClient(ips, user='******', pkey=pkey) client_outputs = client_host.run_command( 'bash $HOME/automate/tools/scripts/run_system.sh') ssh_client_output(client_outputs)
HOME = os.environ['HOME'] # find all available hosts hosts = [] with open(IP_PATH, "r") as f: for line in f: hosts.append(line.rstrip()) # ssh commands pkey = load_private_key(HOME + '/.ssh/id_rsa_pis') client = ParallelSSHClient(hosts, user='******', pkey=pkey) # terminate the running program by soft terminate signal output = client.run_command('kill -15 "$(pgrep python)"') ssh_client_output(output) config = ConfigParser.ConfigParser() config.read(NODE_CONFIG) model, system = config.get('Node Config', 'model', 0), config.get('Node Config', 'system', 0) dir_name = '/' + model + '-' + system + '-' + strftime("%Y-%m-%d %H:%M:%S", localtime()) + '/' subprocess.Popen(['mkdir', HOME + '/stats' + dir_name]) for n in range(1, len(list(config.items('Node IP'))) + 1): node_id = 'n' + str(n) ip = config.get('Node IP', node_id, 0) subprocess.Popen([ 'scp', '-i', HOME + '/.ssh/id_rsa_pis', 'pi@' + ip + ':/home/pi/stats',
def start_server(ips): server_hosts = ParallelSSHClient(ips, user='******', pkey=pkey) servers_outputs = server_hosts.run_command( 'bash $HOME/automate/tools/scripts/run_system.sh server') ssh_client_output(servers_outputs)