Mercurial > public > ssdt-docker
annotate scripts/exec-all-projects.sh @ 229:6210629ba54f production v1.7.0
flow: Merged <release> 'v1.7.0' to <master> ('production').
author | smith@nwoca.org |
---|---|
date | Mon, 09 Oct 2017 21:35:35 +0100 |
parents | fea886ba7279 |
children | f6bea554980e |
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 # |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
13 # /ssdt/scripts/exec-all-projects.sh /data/pilot docker-compose ps |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
14 # |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
15 # executes "docker-compose ps" against all projects under /data/pilot |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
16 # |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
17 # /ssdt/scripts/exec-all-projects.sh /data/pilot /ssdt/ /ssdt/scripts/backup-usas.sh |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
18 # |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
19 # runs backup-usas.sh script against all projects under /data/pilot |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
20 # |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
21 # /ssdt/scripts/exec-all-projects.sh /data/pilot "/ssdt/scripts/capture.sh | /ssdt/scripts/send.sh -" |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
22 # |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
23 # captures the log files from all containers and sends one long file per project |
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 # |
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
26 # |
186
620ea742f1df
DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents:
54
diff
changeset
|
27 ## |
620ea742f1df
DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents:
54
diff
changeset
|
28 |
191
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
29 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
|
30 |
186
620ea742f1df
DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents:
54
diff
changeset
|
31 : ${1?"Usage: {parent path} [command]"} |
51
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
32 |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
33 ORIGINALDIR=$PWD |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
34 PARENTDIR=$1 |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
35 |
187 | 36 shift |
37 COMMAND=$@ | |
38 | |
51
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
39 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
|
40 do |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
41 projectdir=`dirname $f` |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
42 project=`basename $projectdir` |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
43 cd $projectdir |
187 | 44 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
|
45 |
187 | 46 bash -c "${COMMAND}" |
47 echo "" | |
191
fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
smith@nwoca.org
parents:
187
diff
changeset
|
48 |
51
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
49 done |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
50 |
40e10b1d32f7
add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff
changeset
|
51 cd $ORIGINALDIR |