Mercurial > public > ssdt-docker
diff scripts/exec-all-projects-docker.sh @ 399:bfed402ab6b0 production
INV-197 merge release/v2.13.0 into production
author | Matt Calmes <calmes@ssdt-ohio.org> |
---|---|
date | Thu, 28 Oct 2021 07:55:48 -0400 |
parents | d75786228e6b |
children | 5d5525414c8d e97aa313253e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/exec-all-projects-docker.sh Thu Oct 28 07:55:48 2021 -0400 @@ -0,0 +1,42 @@ +#!/bin/bash +# Scans for standard SSDT docker projects in specified parent path and +# executes the specified command. +# +# The first parameter specifices the parent directory to search for. +# +# The second parameter specifies the command to execute against each +# SSDT standard docker project found under the parent directory. +# +# examples: +# +# /ssdt/scripts/exec-all-projects-docker.sh /data/prod /ssdt/scripts/backup-inventory.sh +# +# runs backup-inventory.sh script against all projects under /data/prod +# +## + +source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh" + +: ${1?"Usage: {parent path} [command]"} + +ORIGINALDIR=$PWD +PARENTDIR=$1 + +shift +COMMAND=$@ + +for f in $(find $PARENTDIR -type d -name .env) +do + projectdir=`dirname $f` + project=`basename $projectdir` + cd $projectdir + if ls .env/ssdt-*-shared.properties 1> /dev/null 2>&1; then + echo "projectdir is $projectdir" + echo -e "----\n$executing $COMMAND on $project \n----" + + bash -c "${COMMAND}" + echo "" + fi +done + +cd $ORIGINALDIR