在多个后台屏幕中运行多个命令

在多个后台屏幕中运行多个命令

我有一个长时间运行的进程命令,我将其拆分成 10 个。这就是为什么我尝试使用 运行 10 个命令而不是 1 个screen命令。如果我手动打开屏幕并一个接一个地运行这些命令,那么一切都会顺利进行。但我想自动执行任务。这就是我编写以下 shell 脚本的原因。不幸的是,有时一些屏幕不会自动加载。

screen -dmS Screen01
screen -S Screen01 -p 0 -X stuff 'Some command that run for more than 20 hours\n'

screen -dmS Screen02
screen -S Screen02 -p 0 -X stuff 'Some command that run for more than 20 hours\n'

screen -dmS Screen03
screen -S Screen03 -p 0 -X stuff 'Some command that run for more than 20 hours\n'

screen -dmS Screen04
screen -S Screen04 -p 0 -X stuff 'Some command that run for more than 20 hours\n'

screen -dmS Screen05
screen -S Screen05 -p 0 -X stuff 'Some command that run for more than 20 hours\n'

screen -dmS Screen06
screen -S Screen06 -p 0 -X stuff 'Some command that run for more than 20 hours\n'

screen -dmS Screen07
screen -S Screen07 -p 0 -X stuff 'Some command that run for more than 20 hours\n'

screen -dmS Screen08
screen -S Screen08 -p 0 -X stuff 'Some command that run for more than 20 hours\n'

screen -dmS Screen09
screen -S Screen09 -p 0 -X stuff 'Some command that run for more than 20 hours\n'

screen -dmS Screen10
screen -S Screen10 -p 0 -X stuff 'Some command that run for more than 20 hours\n'

有时会Screen07缺失,有时Screen04会缺失,有时会缺失多个。

我怎样才能使这个过程自动化?

相关内容