Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- from threading import Thread
- from time import sleep
- l_password = "passwordofPi"
- l_host = "192.168.2.3"
- l_user = "pi"
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh.connect(l_host, username=l_user, password=l_password)
- transport = ssh.get_transport()
- session = transport.open_session()
- session.set_combine_stderr(True)
- session.get_pty()
- session.exec_command("nohup lora_gateway/libloragw/test_loragw_hal -a 868.6 -b 868.9 -t 850 -r 1257 > log.txt & ")
- stdin = session.makefile('wb', -1)
- stdout = session.makefile('rb', -1)
- stdin.write(l_password +'n')
- stdin.flush()
- for line in stdout.read().splitlines():
- print ('host: %s: %s' % (l_host, line))
- if ssh is not None:
- ssh.close()
- ssh = None
Add Comment
Please, Sign In to add comment