I am trying to update the router with a python script with only one ssh call. However, the kill() function is executed before the update starts.
process_1 = f' opkg update'
process_2 = f' echo process 2'
cmds = [
f'{process_1}\n',
f'{process_2}'
]
proc = subprocess.Popen(["ssh", "root@192.168.1.1"], stdin=subprocess.PIPE)
for cmd in cmds:
proc.stdin.write(f'{cmd}'.encode())
proc.stdin.flush()
proc.stdin.close()
proc.kill()