Description of problem: Beakerlib should provide some function to repeat a given command periodically till executed successfully or till some timeout expires. For example: we run OpenLDAP server via valgrind on the background and need to wait till the initialization is finished (tcp/389 port is available). "sleep" is a dummy solution, because it slows down the test on fast machines and can cause the test to fail on slow machines. Here is a simple proposal, how it could work: function rlTryRepeat() { command=$1 retries=${2:-30} for (( retry=0; retry < $retries; retry++ )); do $command && return 0 || sleep 1 done return 1 } function rlWaitTcpPort() { port=$1 host=${2:-localhost} retries=$3 rlTryRepeat "nc -z $host $port" $retries } Usage: rlRun "valgrind ... slapd ... &" rlWaitTcpPort 389 rlRun "ldapsearch ..." Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
*** This bug has been marked as a duplicate of bug 970143 ***