Files
alfresco-community-repo/packaging/tests/scripts/wait-for-alfresco-start.sh
Alan Davis 13bfefc1f1 REPO-5271 Backport new structure to relaese/6.0.0 (#14)
- Simplify dependencies and standardise order
- README updated
- Green builds
- Changes to make Jars in enterprise war match
- Changes to make files in enterprise image match
- Added travis_wait 40 to the initial build as it can take 20 minutes to download artifacts
- Removed TAS tests from .travis.yml but not the code as TAS tests require Java 11 - Added in an empty test so the build runs on feature branches.
2020-09-27 10:58:57 +01:00

44 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
export ALFRESCO_URL=$1
export EXTRA_WAIT_INTERVAL=$2
if [ -z "$ALFRESCO_URL" ]
then
echo "Please provide the Alfresco URL to check, for example: \"${0##*/} http://localhost:8080/alfresco\""
exit 1
fi
WAIT_INTERVAL=1
COUNTER=0
TIMEOUT=300
t0=$(date +%s)
echo "Waiting for alfresco to start"
until $(curl --output /dev/null --silent --head --fail ${ALFRESCO_URL}) || [ "$COUNTER" -eq "$TIMEOUT" ]; do
printf '.'
sleep $WAIT_INTERVAL
COUNTER=$(($COUNTER+$WAIT_INTERVAL))
done
if (("$COUNTER" < "$TIMEOUT")) ; then
t1=$(date +%s)
delta=$((($t1 - $t0)/60))
echo "Alfresco Started in $delta minutes"
if [ -n "$EXTRA_WAIT_INTERVAL" ]
then
echo "Waiting an extra $EXTRA_WAIT_INTERVAL for all the containers to initialise..."
sleep $EXTRA_WAIT_INTERVAL
echo "Waited $EXTRA_WAIT_INTERVAL seconds"
fi
else
echo "Waited $COUNTER seconds"
echo "Alfresco Could not start in time."
echo "All started containers:"
docker ps -a
ALFCONTAINER=`docker ps -a | grep _alfresco | awk '{ print $1 }'`
echo "Last 200 lines from alfresco.log on container $ALFCONTAINER:"
docker logs --tail=200 $ALFCONTAINER
exit 1
fi