comparison scripts/exec-all-projects.sh @ 186:620ea742f1df

DEP-12: add script to execute commands against multiple projects.
author smith@nwoca.org
date Wed, 20 Sep 2017 16:52:37 +0100
parents scripts/updates-apply.sh@334d65dac778
children 6b950e1a95e6
comparison
equal deleted inserted replaced
185:21eebe9c1a8c 186:620ea742f1df
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
12 : ${1?"Usage: {parent path} [command]"}
13 COMMAND=${2:-*app}
14
15 ORIGINALDIR=$PWD
16 PARENTDIR=$1
17
18 for f in $(find $PARENTDIR -name docker-compose.yml)
19 do
20 projectdir=`dirname $f`
21 project=`basename $projectdir`
22 cd $projectdir
23 echo -e "----\n$executing $COMMAND on $project"
24
25 bash -c ${COMMAND}
26
27 done
28
29 cd $ORIGINALDIR