I am finding hard to run a process at background using paramiko. I used :
stdin, stdout, stderr = ssh.exec_command(\'executefile.py &\')
I tried transport
class and it was really great. Here's the code I used:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname = "host_ip", username = "un"], password = "up")
channel = ssh.get_transport().open_session()
pty = channel.get_pty()
shell = ssh.invoke_shell()
shell.send("cd /my/directory/; nohup ./exec_name > /dev/null 2>&1 &\n")
But I still don't know how to kill it using python scripts; I have an open question about it here.
EDIT 1:
I have solved my problem about killing the process somehow; you can check it.