Skip to content

Commit

Permalink
FIX : dlog script waiting for server to start
Browse files Browse the repository at this point in the history
  • Loading branch information
sgonzalezoyuela committed Jan 11, 2023
1 parent f35b980 commit fc4abdb
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions distributions/iam-tf-cloud/src/main/resources/docker/dlog
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,35 @@ file="/opt/atricore/iamtf/server/data/log/atricore.log"
# Set the string to be searched for
search_string=$1

# Set the number of attempts
attempts=0

# Start the loop to continuously search the file
while true; do
# Print the attempt number
echo "Waiting for server ... attempt: $((attempts+1))"

# Search the file using grep
grep "$search_string" $file

# Check the exit code of the previous command
# If the exit code is 0, it means the string was found
if [ $? -eq 0 ]; then
# Exit the loop
echo "Server started !"
break
fi

# Sleep for 5 seconds before searching the file again
sleep 5
done
# Increase the number of attempts
attempts=$((attempts+1))

# If the number of attempts is greater than 10, exit with an error
if [ $attempts -gt 10 ]; then
echo "Error: maximum number of attempts reached"
exit 1
fi

# Sleep for 15 seconds before searching the file again
sleep 15
done
``

0 comments on commit fc4abdb

Please sign in to comment.