我已经搜索了很多东西,并且在面料常见问题中还说要与它一起使用screen dtach,但是没有找到如何实现它的方法? 下面是我的错误代码,sh不会执行,除非它是一个nohup任务
i have googled a lot,and in fabric faq also said use screen dtach with it ,but didn't find how to implement it? bellow is my wrong code,the sh will not execute as excepted it is a nohup task
def dispatch(): run("cd /export/workspace/build/ && if [ -f spider-fetcher.zip ];then mv spider-fetcher.zip spider-fetcher.zip.bak;fi") put("/root/build/spider-fetcher.zip","/export/workspace/build/") run("cd /export/script/ && sh ./restartCrawl.sh && echo 'finished'")推荐答案
我已经分两步做到了:
以分离模式在远程服务器上启动tmux会话:
Start tmux session on remote server in detached mode:
run("tmux new -d -s foo"")
run("tmux new -d -s foo")
将命令发送到分离的tmux会话:
Send command to the detached tmux session:
run("tmux send -t foo.0 ls ENTER")
run("tmux send -t foo.0 ls ENTER")
此处"-t"确定目标会话("foo"),"foo.0"告诉 要在其中执行"ls"命令的窗格的编号.
here '-t' determines target session ('foo') and 'foo.0' tells the number of the pane the 'ls' command is to be executed in.
更多推荐
如何将织物与dtach,屏幕一起使用,是否有一些示例
发布评论