annotate scripts/exec-all-projects-docker.sh @ 389:4e42c10e3c0d

INV-197 update db backup helper scripts for inventory and workflow
author Matt Calmes <calmes@ssdt-ohio.org>
date Mon, 18 Oct 2021 07:05:16 -0400
parents 23d40b345e1e
children d75786228e6b
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
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
2 # Scans for docker projects in specified parent path and
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 #
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
5 # The first parameter specifices theparent directory to search for
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
6 # docker-compose.yml # files must be specified. #
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
7 #
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
8 # the second paramter specifies the command to execute against each
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
9 # compose project.
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
10 #
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
11 # examples:
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
12 #
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
13 # /ssdt/scripts/exec-all-projects.sh /data/prod docker-compose ps
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
14 #
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
15 # executes "docker-compose ps" against all projects under /data/prod
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 # /ssdt/scripts/exec-all-projects.sh /data/prod /ssdt/ /ssdt/scripts/backup-usas.sh
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
18 #
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
19 # runs backup-usas.sh script against all projects under /data/prod
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
20 #
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
21 # /ssdt/scripts/exec-all-projects.sh /data/prod "/ssdt/scripts/capture.sh | /ssdt/scripts/send.sh -"
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
22 #
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
23 # captures the log files from all containers and sends one log file per project
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
24 # to the SSDT support server.
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
25 #
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
26 ##
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 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
29
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
30 : ${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
31
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
32 ORIGINALDIR=$PWD
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
33 PARENTDIR=$1
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
34
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
35 shift
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
36 COMMAND=$@
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
37
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
38 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
39 do
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
40 projectdir=`dirname $f`
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
41 project=`basename $projectdir`
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
42 cd $projectdir
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
43 echo "projectdir is $projectdir"
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
44 echo -e "----\n$executing $COMMAND on $project \n----"
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
45
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
46 #bash -c "${COMMAND}"
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
47 echo ""
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
48
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
49 done
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
50
23d40b345e1e INV-197 create db backup helper scripts for inventory and workflow
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
51 cd $ORIGINALDIR