annotate scripts/exec-all-projects-docker.sh @ 586:f897ce55c610 production v2.19.0

flow: Merged <release> '2.19.0' to <master> ('production').
author Marc Davis <marc.davis@mcoecn.org>
date Thu, 05 Sep 2024 14:09:51 -0400
parents 5d5525414c8d
children 652e0b0552b1
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 #
539
5d5525414c8d update exec-all-projects-docker.sh to search for ./env/*-shared.properties in place of ./env/ssdt-*-shared.properties. ESS doesn't follow the same pattern for property file names.
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
539
5d5525414c8d update exec-all-projects-docker.sh to search for ./env/*-shared.properties in place of ./env/ssdt-*-shared.properties. ESS doesn't follow the same pattern for property file names.
Marc Davis <marc.davis@mcoecn.org>
parents: 390
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"
d75786228e6b INV-197 wire workflows backup into shared scripts
Matt Calmes <calmes@ssdt-ohio.org>
parents: 388
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