annotate scripts/exec-all-projects-docker.sh @ 564:429ab7060baf

use different version
author belknapSSDT <zach.belknap@mcoecn.org>
date Fri, 24 May 2024 10:37:11 -0400
parents d75786228e6b
children 5d5525414c8d e97aa313253e
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 #
390
d75786228e6b INV-197 wire workflows backup into shared scripts
Matt Calmes <calmes@ssdt-ohio.org>
parents: 388
diff changeset
5 # The first parameter specifices 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
390
d75786228e6b INV-197 wire workflows backup into shared scripts
Matt Calmes <calmes@ssdt-ohio.org>
parents: 388
diff changeset
33 if ls .env/ssdt-*-shared.properties 1> /dev/null 2>&1; then
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