我想从其他实例
使用python运行bash命令我可以使用子进程本地调用命令
subprocess.call(myfile.sh)
我想从其他实例调用myfile.sh
答案 0 :(得分:1)
看过你的评论如下:
import paramiko
client = paramiko.SSHClient()
#client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(host_ip, username=your_username, password=your_password)
ftp = client.open_sftp()
ftp.put(myfile.sh)
stdin, stdout, stderr = client.exec_command(sh myfile) #or sh myfile.sh I think
print stdout