annotate scripts/exec-all-projects.sh @ 187:6b950e1a95e6

DEP-12: update exec script.
author smith@nwoca.org
date Wed, 20 Sep 2017 16:57:30 +0100
parents 620ea742f1df
children fea886ba7279
rev   line source
54
334d65dac778 add hash bangs to specify bash shell
smith@nwoca.org
parents: 52
diff changeset
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.
620ea742f1df DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents: 54
diff changeset
10 ##
620ea742f1df DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents: 54
diff changeset
11
620ea742f1df DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents: 54
diff changeset
12 : ${1?"Usage: {parent path} [command]"}
51
40e10b1d32f7 add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff changeset
13
40e10b1d32f7 add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff changeset
14 ORIGINALDIR=$PWD
40e10b1d32f7 add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff changeset
15 PARENTDIR=$1
40e10b1d32f7 add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff changeset
16
187
6b950e1a95e6 DEP-12: update exec script.
smith@nwoca.org
parents: 186
diff changeset
17 shift
6b950e1a95e6 DEP-12: update exec script.
smith@nwoca.org
parents: 186
diff changeset
18 COMMAND=$@
6b950e1a95e6 DEP-12: update exec script.
smith@nwoca.org
parents: 186
diff changeset
19
51
40e10b1d32f7 add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff changeset
20 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
21 do
40e10b1d32f7 add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff changeset
22 projectdir=`dirname $f`
40e10b1d32f7 add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff changeset
23 project=`basename $projectdir`
40e10b1d32f7 add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff changeset
24 cd $projectdir
187
6b950e1a95e6 DEP-12: update exec script.
smith@nwoca.org
parents: 186
diff changeset
25 echo -e "----\n$executing $COMMAND on $project \n----"
186
620ea742f1df DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents: 54
diff changeset
26
187
6b950e1a95e6 DEP-12: update exec script.
smith@nwoca.org
parents: 186
diff changeset
27 bash -c "${COMMAND}"
6b950e1a95e6 DEP-12: update exec script.
smith@nwoca.org
parents: 186
diff changeset
28 echo ""
186
620ea742f1df DEP-12: add script to execute commands against multiple projects.
smith@nwoca.org
parents: 54
diff changeset
29
51
40e10b1d32f7 add script to apply image updates to compose projects
Dave smith <smith@nwoca.org>
parents:
diff changeset
30 done
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 cd $ORIGINALDIR