Skip to content

Instantly share code, notes, and snippets.

@nguyenthang98
Last active February 21, 2021 09:41
Show Gist options
  • Select an option

  • Save nguyenthang98/18a9e4e528413dd0c8f2bc3e02a7e79c to your computer and use it in GitHub Desktop.

Select an option

Save nguyenthang98/18a9e4e528413dd0c8f2bc3e02a7e79c to your computer and use it in GitHub Desktop.
#!/bin/bash
attemp=5
count=0
while ! $(./check_script.sh >/tmp/script_stdout.log 2>/tmp/script_stderr.log) && [[ $count -lt $attemp ]]; do
count=$((count + 1))
echo "Check failed. Retrying ($(($attemp - count)) attemp remaining)..."
echo "==================DEBUG==================="
echo "STDOUT:"
cat /tmp/script_stdout.log
>&2 echo "STDERR:"
>&2 cat /tmp/script_stderr.log
echo "=========================================="
sleep 1
done
echo "STDOUT: "
cat /tmp/script_stdout.log
>&2 echo "STDERR: "
>&2 cat /tmp/script_stderr.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment