I am running a series of remote shell commands leveraging the Paramiko library.
The final command requires user input at the end device and I do not need to wait for execution to complete; however, I cannot proceed until the last command completes.
Code:
k = paramiko.RSAKey.from_private_key_file("....", password="....")
conn = paramiko.SSHClient()
conn.connect(hostname=ip_addr, username="root", pkey=k, password="....")
commands = ["chmod 755 /tmp/evtool", "nohup /tmp/test.sh >/dev/null 2>&1"]
for command in commands:
stdin, stdout, stderr = conn.exec_command(command)
conn.close()
The command in question is :
nohup /tmp/test.sh >/dev/null 2>&1
No matter how I attempt to run it :
/tmp/test.sh
/tmp/test.sh&
The application waits for the process to complete; however the completion could take hours and the pass / fail is displayed on the remote unit, I do not need to wait for a result.
I have dozens of remote units and the above function is called from a loop that iterates through the unit ip addresses and makes the connection / runs the test.
Any ideas how not to wait for the last process to complete?
Thanks, Dan.