スクリプトエラー「フォーク:再試行:リソースを一時的に使用できません」。失敗した行を再試行しますか?

スクリプトエラー「フォーク:再試行:リソースを一時的に使用できません」。失敗した行を再試行しますか?

バックグラウンドでping呼び出しを実行するpingスクリプトを実行しています。

#!/bin/bash for ip in $(seq 100 210); do ping x.x.x.$ip -c1 |grep "bytes from" |cut -d " " -f4|cut -d ":" -f1 & done fork: retry: Resource temporarily unavailableループ反復中にエラーが発生した場合、その反復が元に戻せないように失敗しますか、またはリソースが利用可能になるとスクリプトは自動的に再実行を試みますか?

ベストアンサー1

オペレーティングシステムは、失敗したコマンドを独自に再起動できません。ただし、これらのメカニズムをスクリプトに構築できます。フォークが失敗すると -1 が返され、子プロセスは生成されません。上記のエラーが発生する理由は次のとおりです。イガオン。リソース制限(ulimitとメモリ)を確認してください。以下のマニュアルページの関連セクション -

RETURN VALUE
        On  success,  the  PID  of the child process is returned in  the parent, 
and 0 is returned in the child.  On failure, -1 is returned in
 the parent, no child process is created, and errno is set appropriately.

EAGAIN fork() cannot allocate sufficient memory to copy the parent's page tables and 
allocate a task structure for the child.

EAGAIN It was not possible to create a new process because the caller's RLIMIT_NPROC 
resource limit was  encountered.   To  exceed  this  limit,  the
process must have either the CAP_SYS_ADMIN or the CAP_SYS_RESOURCE capability.

おすすめ記事