fn: sgnd_retry
Purpose
Retry a command a fixed number of times with a delay.
Arguments
$1— Maximum attempts (at least 1).$2— Delay between attempts, in seconds. $3... Executable command and its arguments.
Side effects
Executes the command up to the specified limit and sleeps between failed attempts.
Returns
- 0 when the command succeeds; 1 when all attempts fail; 2 for invalid count or missing command.
Usage
sgnd_retry 3 1 test -f "/tmp/ready.flag"
