20 lines
582 B
Python
20 lines
582 B
Python
import paramiko
|
|
|
|
|
|
async def cleanup_iperf_server(node, ip, username, password, log):
|
|
await log("++ stopping iperf server on {}".format(node))
|
|
|
|
myconn = paramiko.SSHClient()
|
|
myconn.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
|
|
myconn.connect(ip, username=username, password=password)
|
|
|
|
remote_cmd = 'pgrep iperf | xargs kill'
|
|
(stdin, stdout, stderr) = myconn.exec_command(remote_cmd)
|
|
out = stdout.read()
|
|
err = stderr.read()
|
|
if out:
|
|
await log("{}".format(out))
|
|
if err:
|
|
await log("err: {}".format(err))
|
|
myconn.close() |