Mercurial > public > ssdt-docker
comparison 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 |
comparison
equal
deleted
inserted
replaced
387:d6f2270566e9 | 399:bfed402ab6b0 |
---|---|
1 #!/bin/bash | |
2 # Scans for standard SSDT docker projects in specified parent path and | |
3 # executes the specified command. | |
4 # | |
5 # The first parameter specifices the parent directory to search for. | |
6 # | |
7 # The second parameter specifies the command to execute against each | |
8 # SSDT standard docker project found under the parent directory. | |
9 # | |
10 # examples: | |
11 # | |
12 # /ssdt/scripts/exec-all-projects-docker.sh /data/prod /ssdt/scripts/backup-inventory.sh | |
13 # | |
14 # runs backup-inventory.sh script against all projects under /data/prod | |
15 # | |
16 ## | |
17 | |
18 source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh" | |
19 | |
20 : ${1?"Usage: {parent path} [command]"} | |
21 | |
22 ORIGINALDIR=$PWD | |
23 PARENTDIR=$1 | |
24 | |
25 shift | |
26 COMMAND=$@ | |
27 | |
28 for f in $(find $PARENTDIR -type d -name .env) | |
29 do | |
30 projectdir=`dirname $f` | |
31 project=`basename $projectdir` | |
32 cd $projectdir | |
33 if ls .env/ssdt-*-shared.properties 1> /dev/null 2>&1; then | |
34 echo "projectdir is $projectdir" | |
35 echo -e "----\n$executing $COMMAND on $project \n----" | |
36 | |
37 bash -c "${COMMAND}" | |
38 echo "" | |
39 fi | |
40 done | |
41 | |
42 cd $ORIGINALDIR |