comparison scripts/updates-apply.sh @ 260:6aecbb32c587

fix script to not start stopped containers
author aldrich@nwoca.org
date Thu, 12 Jul 2018 16:04:09 +0100
parents fea886ba7279
children
comparison
equal deleted inserted replaced
259:95c897db1e67 260:6aecbb32c587
10 # Only services which are currently running will be updated. 10 # Only services which are currently running will be updated.
11 # The script will not automatically start stopped services. 11 # The script will not automatically start stopped services.
12 # 12 #
13 # examples: 13 # examples:
14 # /ssdt/apply-updates.sh /data/preview 14 # /ssdt/apply-updates.sh /data/preview
15 # /ssdt/apply-updates.sh /data/preview usps 15 # /ssdt/apply-updates.sh /data/preview uspsapp
16 # 16 #
17 17
18 source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh" 18 source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh"
19 19
20 : ${1?"Usage: {parent path} [service]"} 20 : ${1?"Usage: {parent path} [service]"}
32 while read line 32 while read line
33 do 33 do
34 read container eol <<< $line 34 read container eol <<< $line
35 if [[ $container == *_1 ]] 35 if [[ $container == *_1 ]]
36 then 36 then
37 t=(${container//_/ }) 37 if [[ $eol =~ "Up" ]]
38 service=${t[1]}
39 if [[ $service == $SERVICE ]]
40 then 38 then
41 echo -e "\n$project: Updating $service" 39 t=(${container//_/ })
42 docker-compose up -d $service 40 service=${t[1]}
41 if [[ $service == $SERVICE ]]
42 then
43 echo -e "\n$project: Updating $service"
44 docker-compose up -d $service
45 fi
43 fi 46 fi
44 fi 47 fi
45 done < <(docker-compose ps) 48 done < <(docker-compose ps)
46 49
47 done 50 done