【发布时间】:2013-11-27 22:31:04
【问题描述】:
我正在尝试确保在并行命令终止后串行运行命令。
command1 &
command2 &
command3
在上面的例子中,command1 和command2 在后台同时启动,但command3 很快就会运行。我知道这是 Bash 中的预期行为,但我想知道是否有办法在 command1 和 command2 终止后启动 command3。
或许可以这样做:
(command1; touch done1) &
(command2; touch done2) &
while [ ! -f done1 ] && [ ! -f done2 ]; do sleep 1000; done
command3
...但是如果有更优雅的解决方案可用,我会接受。连接需要是被动的,因为这些命令注定要在 PBS 队列中使用。有任何想法吗?提前致谢。
【问题讨论】:
标签: bash parallel-processing jobs