【问题标题】:ssh and bring up many processes in parallel + solarisssh 并并行启动许多进程 + solaris
【发布时间】:2012-01-30 10:37:52
【问题描述】:

我有很多流程,每个流程都需要很长时间才能启动(5-10 分钟)。

我在 abc@abc1 中运行我的脚本,并通过 ssh 连接到 xyz@xyz1 以启动守护进程。

在另一台机器(xyz@xyz1)中,我想并行启动 10 个进程(在那里调用启动脚本)。 然后在 10 分钟后,我会检查它们的状态是向上还是向下。

我这样做是因为我希望(我的)脚本的执行时间最短。

如何在最短的时间内使用 shell 脚本来做到这一点?

谢谢

【问题讨论】:

    标签: shell unix scripting ssh


    【解决方案1】:

    这样的事情应该可以启动您的流程:

    for cmd in bin/proc1 bin/proc2 bin/procn; do
        logfile=var/${cmd#bin/}.out
        ssh xyz@xyz1 "bash -c '$cmd > $logfile 2>&1 &' && echo 'started $cmd in the background. See $logfile for its output.'"
    done
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多