Skip to content

Instantly share code, notes, and snippets.

@nirui
Last active May 31, 2020 02:29
Show Gist options
  • Save nirui/6b01864cc047b19a01b69bc8f232acd5 to your computer and use it in GitHub Desktop.
Save nirui/6b01864cc047b19a01b69bc8f232acd5 to your computer and use it in GitHub Desktop.
#!/bin/bash
TEST_TARGET=$1
RECOVER_COMMANDS=("${@:2}")
while true; do
for RECOVER_CMD in "${RECOVER_COMMANDS[@]}"; do
while true; do
sleep 1
(eval $TEST_TARGET)
if [[ $? -eq 0 ]]; then
continue 3
fi
(eval $RECOVER_CMD)
break
done
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment