aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-08-29 10:31:22 -0300
committerEuAndreh <eu@euandre.org>2024-08-29 10:31:22 -0300
commitd4acb7364c3bac1156a67648464e022e54a236f9 (patch)
tree3ed0c4038b2a5e096160cd5cbda3fe5e598711c3
parentetc/ssh/config.tmpl: Disable PasswordAuthentication by default (diff)
downloaddotfiles-d4acb7364c3bac1156a67648464e022e54a236f9.tar.gz
dotfiles-d4acb7364c3bac1156a67648464e022e54a236f9.tar.xz
rm bin/untill: Moved to eut
-rwxr-xr-xbin/untill94
1 files changed, 0 insertions, 94 deletions
diff --git a/bin/untill b/bin/untill
deleted file mode 100755
index 9290cfe..0000000
--- a/bin/untill
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/bin/sh
-set -eu
-
-usage() {
- cat <<-'EOF'
- Usage:
- until [-m MAX] [-n SECONDS] COMMAND...
- until -h
- EOF
-}
-
-help() {
- cat <<-'EOF'
-
-
- Options:
- -n SECONDS the amount of seconds to sleep between
- attempts (default: 5)
- -m MAX the maximum number of attempts (default: unlimited)
- -h, --help show this message
-
- COMMAND the shell command to be executed
-
-
- Runs COMMAND until it eventually succeeds, trying atmost MAX
- times. Sleep SECONDS between attempts.
-
-
- Examples:
-
- Try flaky build until it succeeds:
-
- $ until guix home build home.scm
-
-
- Try atmost 10 timex to build until a new version is successfull,
- waiting 30 seconds between attempts:
-
- $ until -m 10 -n 30 -- x git pull AND make
- EOF
-}
-
-
-for flag in "$@"; do
- case "$flag" in
- (--)
- break
- ;;
- (--help)
- usage
- help
- exit
- ;;
- (*)
- ;;
- esac
-done
-
-_SECONDS=5
-while getopts 'm:n:h' flag; do
- case "$flag" in
- (m)
- MAX="$OPTARG"
- ;;
- (n)
- _SECONDS="$OPTARG"
- ;;
- (h)
- usage
- help
- exit
- ;;
- (*)
- usage >&2
- exit 2
- ;;
- esac
-done
-shift $((OPTIND - 1))
-
-
-ATTEMPT=1
-while true; do
- printf 'Attempt %s.\n' "$ATTEMPT" >&2
- ATTEMPT=$((ATTEMPT + 1))
- if "$@"; then
- break
- fi
- if [ -n "${MAX:-}" ] && [ "$ATTEMPT" -gt "$MAX" ]; then
- printf 'Maximum number of attempts reached: %s.\n' "$MAX" >&2
- exit 1
- fi
- sleep "$_SECONDS"
-done