Skip to content

Commit

Permalink
Use timeout command
Browse files Browse the repository at this point in the history
rack-box/scripts/install.sh: Replace while loop and $SECONDS
comparison with easier and more reliable timeout command.
  • Loading branch information
tuxji committed Feb 21, 2024
1 parent 7b5a418 commit 30bbbf6
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions rack-box/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,12 @@ chown -R "${USER}.${USER}" "${WEBAPPS}"
# Wait for Fuseki to become ready

echo "Waiting for Fuseki at http://localhost:3030..."
MAX_SECS=800
while ! curl http://localhost:3030/$/ping &>/dev/null; do
if [[ $SECONDS -gt $MAX_SECS ]]; then
echo "Error: Took longer than $MAX_SECS seconds to start Fuseki"
exit 1
fi
sleep 10
done

if ! timeout 3m bash -c 'until curl http://localhost:3030/$/ping &>/dev/null; do sleep 10; done'; then
echo "Error: Took longer than 3 minutes to start Fuseki"
systemctl status fuseki | cat
exit 1
fi

# Configure Fuseki to time out queries after 5 minutes

Expand Down Expand Up @@ -171,15 +169,12 @@ done
# Wait for the nodeGroupService to become ready

echo "Waiting for nodeGroupService at http://localhost:12059..."
MAX_SECS=1200
while ! curl -X POST http://localhost:12059/serviceInfo/ping 2>/dev/null | grep -q yes; do
if [[ $SECONDS -gt $MAX_SECS ]]; then
echo "Error: Took longer than $MAX_SECS seconds to start nodeGroupService"
systemctl status nodeGroupService | cat
exit 1
fi
sleep 10
done

if ! timeout 5m bash -c 'until curl -X POST http://localhost:12059/serviceInfo/ping 2>/dev/null | grep -q yes; do sleep 10; done'; then
echo "Error: Took longer than 5 minutes to start nodeGroupService"
systemctl status nodeGroupService | cat
exit 1
fi

# Setup the RACK dataset using the RACK CLI

Expand Down

0 comments on commit 30bbbf6

Please sign in to comment.