comparison scripts/exec-all-projects-docker.sh @ 390:d75786228e6b

INV-197 wire workflows backup into shared scripts
author Matt Calmes <calmes@ssdt-ohio.org>
date Mon, 25 Oct 2021 12:48:35 -0400
parents 23d40b345e1e
children 5d5525414c8d e97aa313253e
comparison
equal deleted inserted replaced
389:4e42c10e3c0d 390:d75786228e6b
1 #!/bin/bash 1 #!/bin/bash
2 # Scans for docker projects in specified parent path and 2 # Scans for standard SSDT docker projects in specified parent path and
3 # executes the specified command. 3 # executes the specified command.
4 # 4 #
5 # The first parameter specifices theparent directory to search for 5 # The first parameter specifices the parent directory to search for.
6 # docker-compose.yml # files must be specified. #
7 # 6 #
8 # the second paramter specifies the command to execute against each 7 # The second parameter specifies the command to execute against each
9 # compose project. 8 # SSDT standard docker project found under the parent directory.
10 # 9 #
11 # examples: 10 # examples:
12 # 11 #
13 # /ssdt/scripts/exec-all-projects.sh /data/prod docker-compose ps 12 # /ssdt/scripts/exec-all-projects-docker.sh /data/prod /ssdt/scripts/backup-inventory.sh
14 #
15 # executes "docker-compose ps" against all projects under /data/prod
16 # 13 #
17 # /ssdt/scripts/exec-all-projects.sh /data/prod /ssdt/ /ssdt/scripts/backup-usas.sh 14 # runs backup-inventory.sh script against all projects under /data/prod
18 #
19 # runs backup-usas.sh script against all projects under /data/prod
20 #
21 # /ssdt/scripts/exec-all-projects.sh /data/prod "/ssdt/scripts/capture.sh | /ssdt/scripts/send.sh -"
22 #
23 # captures the log files from all containers and sends one log file per project
24 # to the SSDT support server.
25 # 15 #
26 ## 16 ##
27 17
28 source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh" 18 source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh"
29 19
38 for f in $(find $PARENTDIR -type d -name .env) 28 for f in $(find $PARENTDIR -type d -name .env)
39 do 29 do
40 projectdir=`dirname $f` 30 projectdir=`dirname $f`
41 project=`basename $projectdir` 31 project=`basename $projectdir`
42 cd $projectdir 32 cd $projectdir
43 echo "projectdir is $projectdir" 33 if ls .env/ssdt-*-shared.properties 1> /dev/null 2>&1; then
44 echo -e "----\n$executing $COMMAND on $project \n----" 34 echo "projectdir is $projectdir"
35 echo -e "----\n$executing $COMMAND on $project \n----"
45 36
46 #bash -c "${COMMAND}" 37 bash -c "${COMMAND}"
47 echo "" 38 echo ""
48 39 fi
49 done 40 done
50 41
51 cd $ORIGINALDIR 42 cd $ORIGINALDIR