Skip to content

Commit

Permalink
attempting to fix blank erroring out of webONline.bash
Browse files Browse the repository at this point in the history
  • Loading branch information
cyclingzealot committed Sep 22, 2018
1 parent b2b956b commit 407339b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions webOnline.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ START=$(date +%s.%N)

arg1=${1:-''}

TH=20

if [[ $arg1 == '--help' || $arg1 == '-h' ]]; then
echo "Script author should have provided documentation"
echo "Usage: $0 [\$thresholdTimeoutSeconds]"
echo "The first argument is the timeout in seconds. Defaults to ${TH} seconds"
exit 0
fi

TH=${1:-20}


#exit when command fails (use || true when a command can fail)
set -o errexit

Expand Down Expand Up @@ -89,13 +95,12 @@ fi

for page in `cat $configFile | sort | uniq | sort -R `; do
START=$(date +%s.%N)
TH=20
connect=false
attempts=0
set -x
while [ $attempts -lt 3 ] && ! $connect ; do
if ! curl -k -I -fs --max-time $TH $page > /dev/null ; then
let "attempts++"
let "attempts++" || true
else
connect=true
fi
Expand Down

0 comments on commit 407339b

Please sign in to comment.