How do you run multiple programs in parallel from a bash script?

前端 未结 15 1264
眼角桃花
眼角桃花 2020-11-22 06:31

I am trying to write a .sh file that runs many programs simultaneously

I tried this

prog1 
prog2

相关标签:
15条回答
  • 2020-11-22 07:16
    prog1 &
    prog2 &
    
    0 讨论(0)
  • You can try ppss. ppss is rather powerful - you can even create a mini-cluster. xargs -P can also be useful if you've got a batch of embarrassingly parallel processing to do.

    0 讨论(0)
  • 2020-11-22 07:23

    With GNU Parallel http://www.gnu.org/software/parallel/ it is as easy as:

    (echo prog1; echo prog2) | parallel
    

    Or if you prefer:

    parallel ::: prog1 prog2
    

    Learn more:

    • Watch the intro video for a quick introduction: https://www.youtube.com/playlist?list=PL284C9FF2488BC6D1
    • Walk through the tutorial (man parallel_tutorial). Your command line will love you for it.
    • Read: Ole Tange, GNU Parallel 2018 (Ole Tange, 2018).
    0 讨论(0)
提交回复
热议问题