annotate scripts/exec-all-projects-docker.sh @ 605:46a67e7afd98 release/2.23.0 tip

flow: Created branch 'release/2.23.0'.
author Marc Davis <marc.davis@mcoecn.org>
date Wed, 18 Sep 2024 20:38:06 -0400
parents b3ff6b33a9c5
children
rev   line source
388
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
1 #!/bin/bash
390
d75786228e6b INV-197 wire workflows backup into shared scripts
Matt Calmes <calmes@ssdt-ohio.org>
parents: 388
diff changeset
2 # Scans for standard SSDT docker projects in specified parent path and
388
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
3 # executes the specified command.
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
4 #
592
e97aa313253e add ess conditional
Marc Davis <marc.davis@mcoecn.org>
parents: 390
diff changeset
5 # The first parameter specifies the parent directory to search for.
388
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
6 #
390
d75786228e6b INV-197 wire workflows backup into shared scripts
Matt Calmes <calmes@ssdt-ohio.org>
parents: 388
diff changeset
7 # The second parameter specifies the command to execute against each
d75786228e6b INV-197 wire workflows backup into shared scripts
Matt Calmes <calmes@ssdt-ohio.org>
parents: 388
diff changeset
8 # SSDT standard docker project found under the parent directory.
388
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
9 #
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
10 # examples:
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
11 #
390
d75786228e6b INV-197 wire workflows backup into shared scripts
Matt Calmes <calmes@ssdt-ohio.org>
parents: 388
diff changeset
12 # /ssdt/scripts/exec-all-projects-docker.sh /data/prod /ssdt/scripts/backup-inventory.sh
388
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
13 #
390
d75786228e6b INV-197 wire workflows backup into shared scripts
Matt Calmes <calmes@ssdt-ohio.org>
parents: 388
diff changeset
14 # runs backup-inventory.sh script against all projects under /data/prod
388
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
15 #
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
16 ##
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
17
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
18 source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh"
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
19
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
20 : ${1?"Usage: {parent path} [command]"}
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
21
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
22 ORIGINALDIR=$PWD
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
23 PARENTDIR=$1
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
24
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
25 shift
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
26 COMMAND=$@
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
27
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
28 for f in $(find $PARENTDIR -type d -name .env)
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
29 do
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
30 projectdir=`dirname $f`
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
31 project=`basename $projectdir`
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
32 cd $projectdir
598
b3ff6b33a9c5 correct script that was changed on production
Marc Davis <marc.davis@mcoecn.org>
parents: 592
diff changeset
33 if ls .env/*-shared.properties 1> /dev/null 2>&1; then
390
d75786228e6b INV-197 wire workflows backup into shared scripts
Matt Calmes <calmes@ssdt-ohio.org>
parents: 388
diff changeset
34 echo "projectdir is $projectdir"
598
b3ff6b33a9c5 correct script that was changed on production
Marc Davis <marc.davis@mcoecn.org>
parents: 592
diff changeset
35 echo -e "----\n$executing $COMMAND on $project \n----"
388
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
36
390
d75786228e6b INV-197 wire workflows backup into shared scripts
Matt Calmes <calmes@ssdt-ohio.org>
parents: 388
diff changeset
37 bash -c "${COMMAND}"
d75786228e6b INV-197 wire workflows backup into shared scripts
Matt Calmes <calmes@ssdt-ohio.org>
parents: 388
diff changeset
38 echo ""
d75786228e6b INV-197 wire workflows backup into shared scripts
Matt Calmes <calmes@ssdt-ohio.org>
parents: 388
diff changeset
39 fi
388
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
40 done
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
41
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
42 cd $ORIGINALDIR