运行远程bash脚本的python结构
我一直在研究PythonFabric模块。 目前,我已经编写了一个文件来调用远程服务器上的远程bash脚本。然而,我似乎不工作 我的文件如下所示:-运行远程bash脚本的python结构,python,fabric,Python,Fabric,我一直在研究PythonFabric模块。 目前,我已经编写了一个文件来调用远程服务器上的远程bash脚本。然而,我似乎不工作 我的文件如下所示:- from fabric.api import * env.hosts=['some-host'] env.user="root" def deploy(): run("/home/hduser/test.sh") 它在远程主机上执行test.sh #!/bin/bash echo "fabric works" >> ou
from fabric.api import *
env.hosts=['some-host']
env.user="root"
def deploy():
run("/home/hduser/test.sh")
它在远程主机上执行test.sh
#!/bin/bash
echo "fabric works" >> out.txt
但是,即使fabric返回0成功代码,我也不能
请参阅附加了fabric works的out.txt文件
我在这里遗漏了什么。我认为您在错误的目录中查找,out.txt文件可能在root的主目录中。我认为您在错误的目录中查找,out.txt文件可能在root的主目录中