Skip to content

Instantly share code, notes, and snippets.

@virtuosonic
Created October 23, 2024 20:09
Show Gist options
  • Save virtuosonic/eda85b65649af310e028019e4bf5ca16 to your computer and use it in GitHub Desktop.
Save virtuosonic/eda85b65649af310e028019e4bf5ca16 to your computer and use it in GitHub Desktop.
#!/bin/sh
#Author: Gabriel Espinoza<virtuosonic at github>
#Desc: execute comand until it runs successfully(returning 0)
#Date: 23-Oct-2024
usage()
{
echo "usage: retryfailed <command> [arg1 [arg2...]]"
}
if [ $# -eq 0 ];then
usage
exit
fi
RET=1
until [ ${RET} -eq 0 ]; do
$@
RET=$?
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment