如何将织物与dtach,屏幕一起使用,是否有一些示例

编程入门 行业动态 更新时间:2024-10-10 00:24:11
本文介绍了如何将织物与dtach,屏幕一起使用,是否有一些示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经搜索了很多东西,并且在面料常见问题中还说要与它一起使用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,屏幕一起使用,是否有一些示例

    本文发布于:2023-11-25 16:55:55,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1630577.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:织物   示例   如何将   屏幕   dtach

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!