Skip to content
This repository has been archived by the owner on Sep 18, 2022. It is now read-only.

Commit

Permalink
Retry 15 times then give up
Browse files Browse the repository at this point in the history
  • Loading branch information
nolim1t committed May 24, 2020
1 parent 4601c0a commit 3222c20
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion wait-for-node-manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@ shift
cmd="$@"

found=1

iterations=1
until [ $found = 2 ]; do
if node -e "const axios = require('axios').default; axios.get('http://$host:3006/ping').then((resp) => {console.log(resp.data); process.exit(0); }).catch((error) => {process.exit(1) } );" ; then
echo "Can connect, lets proceed with server starting"
found=2
else
echo "Can't connect, keep trying"
fi
if [ $iterations -gt 14 ]; then
echo "Cannot connect after 15 tries, giving up"
exit 1
fi
((iterations=iterations+1))
sleep 2
done

Expand Down

0 comments on commit 3222c20

Please sign in to comment.