ファイルからコマンドを読み取るには?

ファイルからコマンドを読み取るには?

phpたとえば、順番に実行されるいくつかのスクリプトがあります。

php index.php import file1 --offline &&
php index.php import file2 --deleteUnused &&
php index.php import file3

今、私はこのparallelコマンドを新たに見つけて、次のことを試しました。

parallel -j 3 -- "php index.php import file1 --offline" "php index.php import file2 --deleteUnused" "php index.php import file3"

そしてそれは素晴らしい作品です。

上記のすべてのコマンドを含むファイルを持ち、parallelオプションを使用してファイルからコマンドの読み取りを開始できますか?

このような:

parallel -XX myFileWithCommands.txt

ベストアンサー1

作るmyFileWithCommands.txt

php index.php import file1 --offline
php index.php import file2 --deleteUnused
php index.php import file3

その後実行平行線このように:

parallel -j 3 -- < myFileWithCommands.txt

おすすめ記事