Mercurial > public > ssdt-docker
comparison scripts/exec-all-projects.sh @ 195:26bb64873bbe production v1.3.0
flow: Merged <release> 'v1.3.0' to <master> ('production').
author | smith@nwoca.org |
---|---|
date | Thu, 21 Sep 2017 17:14:46 +0100 |
parents | fea886ba7279 |
children | f6bea554980e |
comparison
equal
deleted
inserted
replaced
184:26892906f365 | 195:26bb64873bbe |
---|---|
1 #!/bin/bash | |
2 # Scans for docker projects in specified parent path and | |
3 # executes the specified command. | |
4 # | |
5 # The first parameter specifices theparent directory to search for | |
6 # docker-compose.yml # files must be specified. # | |
7 # | |
8 # the second paramter specifies the command to execute against each | |
9 # compose project. | |
10 # | |
11 # examples: | |
12 # | |
13 # /ssdt/scripts/exec-all-projects.sh /data/pilot docker-compose ps | |
14 # | |
15 # executes "docker-compose ps" against all projects under /data/pilot | |
16 # | |
17 # /ssdt/scripts/exec-all-projects.sh /data/pilot /ssdt/ /ssdt/scripts/backup-usas.sh | |
18 # | |
19 # runs backup-usas.sh script against all projects under /data/pilot | |
20 # | |
21 # /ssdt/scripts/exec-all-projects.sh /data/pilot "/ssdt/scripts/capture.sh | /ssdt/scripts/send.sh -" | |
22 # | |
23 # captures the log files from all containers and sends one long file per project | |
24 # to the SSDT support server. | |
25 # | |
26 # | |
27 ## | |
28 | |
29 source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh" | |
30 | |
31 : ${1?"Usage: {parent path} [command]"} | |
32 | |
33 ORIGINALDIR=$PWD | |
34 PARENTDIR=$1 | |
35 | |
36 shift | |
37 COMMAND=$@ | |
38 | |
39 for f in $(find $PARENTDIR -name docker-compose.yml) | |
40 do | |
41 projectdir=`dirname $f` | |
42 project=`basename $projectdir` | |
43 cd $projectdir | |
44 echo -e "----\n$executing $COMMAND on $project \n----" | |
45 | |
46 bash -c "${COMMAND}" | |
47 echo "" | |
48 | |
49 done | |
50 | |
51 cd $ORIGINALDIR |