Mercurial > public > ssdt-docker
comparison scripts/exec-all-projects.sh @ 191:fea886ba7279
DEP-12: add source for .functions.sh to all scripts using compose
author | smith@nwoca.org |
---|---|
date | Wed, 20 Sep 2017 17:56:23 +0100 |
parents | 6b950e1a95e6 |
children | f6bea554980e |
comparison
equal
deleted
inserted
replaced
190:c3587159637f | 191:fea886ba7279 |
---|---|
5 # The first parameter specifices theparent directory to search for | 5 # The first parameter specifices theparent directory to search for |
6 # docker-compose.yml # files must be specified. # | 6 # docker-compose.yml # files must be specified. # |
7 # | 7 # |
8 # the second paramter specifies the command to execute against each | 8 # the second paramter specifies the command to execute against each |
9 # compose project. | 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 # | |
10 ## | 27 ## |
28 | |
29 source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh" | |
11 | 30 |
12 : ${1?"Usage: {parent path} [command]"} | 31 : ${1?"Usage: {parent path} [command]"} |
13 | 32 |
14 ORIGINALDIR=$PWD | 33 ORIGINALDIR=$PWD |
15 PARENTDIR=$1 | 34 PARENTDIR=$1 |
21 do | 40 do |
22 projectdir=`dirname $f` | 41 projectdir=`dirname $f` |
23 project=`basename $projectdir` | 42 project=`basename $projectdir` |
24 cd $projectdir | 43 cd $projectdir |
25 echo -e "----\n$executing $COMMAND on $project \n----" | 44 echo -e "----\n$executing $COMMAND on $project \n----" |
26 | 45 |
27 bash -c "${COMMAND}" | 46 bash -c "${COMMAND}" |
28 echo "" | 47 echo "" |
29 | 48 |
30 done | 49 done |
31 | 50 |
32 cd $ORIGINALDIR | 51 cd $ORIGINALDIR |