2016-06-30 21 views
1

私はLinuxのシェルスクリプトで配列を持っています。配列には、bashシェルスクリプト内のコマンドのリストが含まれています。たとえば :私は、彼らが終了したときに、個々のプロセスのステータスコードを確認したいGNU Parallelで並列実行されている個々のプロセスの終了コードを確認するには

parallel ::: "${args[@]}" 

怒鳴るよう

args =("ls","mv /abc/file1 /xyz/file2","hive -e 'select * from something'") 

は、今私はGNUのパラレルを使用してアレイにこれらのコマンドを実行しています。 私は$?が私に失敗したプロセスの数を教えてくれることを承知していますしかし、私は個々のプロセスの終了コードを知りたいと思います。 GNU並列で実行される個々のプロセスの終了コードを取得するにはどうすればよいですか?

答えて

0

--joblogログファイル実行されたジョブのための

ログファイル。シーケンス番号、sshlogin、エポックからの秒単位の開始時刻、秒単位の実行時間、転送されたファイルのバイト数、返されたファイルのバイト数、終了ステータス、シグナル、コマンド実行。

+0

これも動作します。ありがとうございました 。 – npaluskar

0

parallelを終了コマンドで終了し、終了コードを返すようにするには、--halt 1オプションを使用します。 man parallelから:

--halt-on-error val 
--halt val 
     How should GNU parallel terminate if one of more jobs fail? 

     0  Do not halt if a job fails. Exit status will be the 
       number of jobs failed. This is the default. 

     1  Do not start new jobs if a job fails, but complete the 
       running jobs including cleanup. The exit status will be 
       the exit status from the last failing job. 

     2  Kill off all jobs immediately and exit without cleanup. 
       The exit status will be the exit status from the 
       failing job. 

     1-99% If val% of the jobs fail and minimum 3: Do not start 
       new jobs, but complete the running jobs including 
       cleanup. The exit status will be the exit status from 
       the last failing job. 
+0

はい、特定のジョブが--- parallelとして終了すると、ステータスが表示されます。このジョブは失敗しました:「あなたのコマンドは失敗しました」。出来た 。ありがとうございました。 – npaluskar

関連する問題