在bash里并行运行命令

要求:

一个job,在server上同时运行几个process,只要有一个process失败 ,整个job就标记成失败。


实现:

command_api

process_api=$!

command_worker

process_worker=$!

command_hworker

process_hworker=$!


wait $process_worker

exit1=$?

wait $process_api

exit2=$?

wait $process_hworker

exit3=$?

exit $(($exit1+$exit2+$exit3))



参考
https://blog.csdn.net/fengfengzai0101/article/details/104047419

Comments

Popular posts from this blog

Small summery of ElasticSearch meetup

The trend in Test

Docker Container mount to a mysteric folder which I don't know where is it.