用python的远程ssh模块paramiko,执行nohup命令

1,797 阅读1分钟
import paramiko
import time

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy)
ssh.connect(hostname='',port=22,username='',password='')
chan = ssh.invoke_shell()
chan.send('nohup tcpreplay -i eno50338560 -p 20 -l 0 bing.pcap')
# 没有time.sleep(1),nohup就不生效
time.sleep(1)