Mercurial > public > ssdt-docker
annotate scripts/exec-all-projects.sh @ 342:27ae05ebfc1a production
Added tag v2.7.0 for changeset 9735d4fef9c5
author | aldrich@ssdt-ohio.org |
---|---|
date | Mon, 04 May 2020 19:13:14 +0100 |
parents | f6bea554980e |
children |
rev | line source |
---|---|
54 | 1 #!/bin/bash |
51
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
2 # Scans for docker projects in specified parent path and |
186
620ea742f1df
DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents:
54
diff
changeset
|
3 # executes the specified command. |
51
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
4 # |
186
620ea742f1df
DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents:
54
diff
changeset
|
5 # The first parameter specifices theparent directory to search for |
620ea742f1df
DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents:
54
diff
changeset
|
6 # docker-compose.yml # files must be specified. # |
620ea742f1df
DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents:
54
diff
changeset
|
7 # |
620ea742f1df
DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents:
54
diff
changeset
|
8 # the second paramter specifies the command to execute against each |
620ea742f1df
DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents:
54
diff
changeset
|
9 # compose project. |
191
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
10 # |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
11 # examples: |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
12 # |
237
f6bea554980e
DEP-14: remove obsolete compose files from preview releases
smith@nwoca.org
parents:
191
diff
changeset
|
13 # /ssdt/scripts/exec-all-projects.sh /data/prod docker-compose ps |
191
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
14 # |
237
f6bea554980e
DEP-14: remove obsolete compose files from preview releases
smith@nwoca.org
parents:
191
diff
changeset
|
15 # executes "docker-compose ps" against all projects under /data/prod |
191
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
16 # |
237
f6bea554980e
DEP-14: remove obsolete compose files from preview releases
smith@nwoca.org
parents:
191
diff
changeset
|
17 # /ssdt/scripts/exec-all-projects.sh /data/prod /ssdt/ /ssdt/scripts/backup-usas.sh |
191
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
18 # |
237
f6bea554980e
DEP-14: remove obsolete compose files from preview releases
smith@nwoca.org
parents:
191
diff
changeset
|
19 # runs backup-usas.sh script against all projects under /data/prod |
191
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
20 # |
237
f6bea554980e
DEP-14: remove obsolete compose files from preview releases
smith@nwoca.org
parents:
191
diff
changeset
|
21 # /ssdt/scripts/exec-all-projects.sh /data/prod "/ssdt/scripts/capture.sh | /ssdt/scripts/send.sh -" |
f6bea554980e
DEP-14: remove obsolete compose files from preview releases
smith@nwoca.org
parents:
191
diff
changeset
|
22 # |
f6bea554980e
DEP-14: remove obsolete compose files from preview releases
smith@nwoca.org
parents:
191
diff
changeset
|
23 # captures the log files from all containers and sends one log file per project |
191
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
24 # to the SSDT support server. |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
25 # |
186
620ea742f1df
DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents:
54
diff
changeset
|
26 ## |
620ea742f1df
DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents:
54
diff
changeset
|
27 |
191
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
28 source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh" |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
29 |
186
620ea742f1df
DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents:
54
diff
changeset
|
30 : ${1?"Usage: {parent path} [command]"} |
51
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
31 |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
32 ORIGINALDIR=$PWD |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
33 PARENTDIR=$1 |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
34 |
187 | 35 shift |
36 COMMAND=$@ | |
37 | |
51
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
38 for f in $(find $PARENTDIR -name docker-compose.yml) |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
39 do |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
40 projectdir=`dirname $f` |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
41 project=`basename $projectdir` |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
42 cd $projectdir |
187 | 43 echo -e "----\n$executing $COMMAND on $project \n----" |
191
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
44 |
187 | 45 bash -c "${COMMAND}" |
46 echo "" | |
191
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
47 |
51
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
48 done |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
49 |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
50 cd $ORIGINALDIR |