Skip to content

Commit

Permalink
Added run-in-loop
Browse files Browse the repository at this point in the history
  • Loading branch information
drivera-armedia committed Sep 14, 2024
1 parent a612051 commit 2ea3c8b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/run-in-loop
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ RUN_LOOP_WAIT_SECS="$(timestr_to_secs "${RUN_LOOP_WAIT}")" || fail "The value [$
# Convert it back, just to make sure we have a timestring here
RUN_LOOP_WAIT="$(secs_to_timestr "${RUN_LOOP_WAIT_SECS}")"

eyes "The command will run in a loop with a ${RUN_LOOP_WAIT} wait between runs"
eyes "The command will run in an endless loop with a ${RUN_LOOP_WAIT} wait between iterations"
ITERATION=0
while true ; do
(( ++ITERATION ))
running "Iteration # ${ITERATION}: ${@@Q}"
"${@}" && ok "Exited with status code 0" || err "Exited with status code ${?}"
[ ${RUN_LOOP_WAIT_SECS} -gt 0 ] || continue
sleeping "Waiting ${RUN_LOOP_WAIT_SECS:-5} seconds before the next iteration"
sleeping "Waiting ${RUN_LOOP_WAIT} before the next iteration"
sleep ${RUN_LOOP_WAIT_SECS}
done

0 comments on commit 2ea3c8b

Please sign in to comment.