From 90c22c66f5d2744a8502ee42c655bc1e2a40199c Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 28 Jun 2018 14:21:22 +0300 Subject: [PATCH] created scripts used to start/stop alfresco --- scripts/cleanImages.sh | 14 ++++++++++++++ scripts/startAlfresco.sh | 31 +++++++++++++++++++++++++++++++ scripts/stopDockerContainers.sh | 7 +++++++ 3 files changed, 52 insertions(+) create mode 100644 scripts/cleanImages.sh create mode 100644 scripts/startAlfresco.sh create mode 100644 scripts/stopDockerContainers.sh diff --git a/scripts/cleanImages.sh b/scripts/cleanImages.sh new file mode 100644 index 0000000000..0445fa2de6 --- /dev/null +++ b/scripts/cleanImages.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +imagesToBeDeleted=$1 +echo $imagesToBeDeleted +echo "List all images:" +docker images -a + +docker_images_list=$(docker images | grep $imagesToBeDeleted | awk '{print $3}' | uniq) +if [ "$docker_images_list" == "" ]; then + echo "No docker images on the agent" +else + echo "Clearing images: $docker_images_list" + docker rmi -f $docker_images_list +fi \ No newline at end of file diff --git a/scripts/startAlfresco.sh b/scripts/startAlfresco.sh new file mode 100644 index 0000000000..f3ed3d2008 --- /dev/null +++ b/scripts/startAlfresco.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -e # exit if commands fails +set -x # trace what gets exe + +docker info +docker-compose --version +echo "Starting Alfresco with AGS amps applied in Docker container" +docker-compose ps +docker-compose up -d + +WAIT_INTERVAL=1 +COUNTER=0 +TIMEOUT=300 +t0=`date +%s` + +echo "Waiting for alfresco to start" +until $(curl --output /dev/null --silent --head --fail http://localhost:8080/alfresco) || [ "$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" +else + echo "Waited $COUNTER seconds" + echo "Alfresco Could not start in time." + exit 1 +fi \ No newline at end of file diff --git a/scripts/stopDockerContainers.sh b/scripts/stopDockerContainers.sh new file mode 100644 index 0000000000..bbdaacc341 --- /dev/null +++ b/scripts/stopDockerContainers.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e # exit if commands fails +set -x # trace what gets exe + +docker-compose ps +docker-compose kill +docker-compose rm -fv \ No newline at end of file