我有如下的fabfile。当我手动 ssh 到远程服务器并完全按照 fabfile 执行命令时,它工作正常。但是,当我运行 fabfile 时,它输出与手动运行时相同的进度,不报告错误并以“完成”退出,但最后一行实际上不起作用。任何建议都会很棒。
更新:
在跟踪 pserve 日志并再尝试几次 fabfile 之后,它随机工作了一次。什么都没有改变,当我随后运行它时,它没有工作。所以我不知道发生了什么。是时间问题吗?
这是代码:
# kills a running pserve process and restarts it in daemon mode
from fabric.api import *
def deploy():
pid = run("pidof -x pserve") # works
run("sudo kill -15 %s" % pid) # works
with cd('~/Repos/bessie'):
run("sudo pserve development.ini --daemon") # outputs "Entering
# daemon mode" but doesn't
# actually start the process
输出:
[ec2-xxx.ap-southeast-2.compute.amazonaws.com] Executing task 'deploy'
[ec2-xxx.ap-southeast-2.compute.amazonaws.com] run: pidof -x pserve
[ec2-xxx.ap-southeast-2.compute.amazonaws.com] out: 28998
[ec2-xxx.ap-southeast-2.compute.amazonaws.com] out:
[ec2-xxx.ap-southeast-2.compute.amazonaws.com] run: sudo kill -15 28998
[ec2-xxx.ap-southeast-2.compute.amazonaws.com] run: sudo pserve development.ini --daemon
[ec2-xxx.ap-southeast-2.compute.amazonaws.com] out: Entering daemon mode
[ec2-xxx.ap-southeast-2.compute.amazonaws.com] out:
Done.