Mercurial > public > ssdt-docker
comparison scripts/backup-container-docker.sh @ 390:d75786228e6b
INV-197 wire workflows backup into shared scripts
author | Matt Calmes <calmes@ssdt-ohio.org> |
---|---|
date | Mon, 25 Oct 2021 12:48:35 -0400 |
parents | 4e42c10e3c0d |
children | 56498d910235 |
comparison
equal
deleted
inserted
replaced
389:4e42c10e3c0d | 390:d75786228e6b |
---|---|
22 grep "${1}" .env/ssdt-inventory-shared.properties|cut -d'=' -f2 | 22 grep "${1}" .env/ssdt-inventory-shared.properties|cut -d'=' -f2 |
23 } | 23 } |
24 entityId=$(prop 'entityId' | tr -d '"') | 24 entityId=$(prop 'entityId' | tr -d '"') |
25 containerName="$entityId-inventory-db" | 25 containerName="$entityId-inventory-db" |
26 IRN=$(docker exec $containerName psql --username=postgres --dbname=$container -t -c 'select districtirn from inventoryconfiguration') | 26 IRN=$(docker exec $containerName psql --username=postgres --dbname=$container -t -c 'select districtirn from inventoryconfiguration') |
27 ## if database is empty, it will put IRN 000000 | |
28 if [ "$IRN" == "" ]; then | |
29 echo "no IRN set,using 000000" | |
30 IRN=000000 | |
31 fi | |
27 ##Take out the extra space from IRN returned from db. | 32 ##Take out the extra space from IRN returned from db. |
28 IRN=`echo $IRN | sed -e 's/^[[:space:]]*//'` | 33 IRN=`echo $IRN | sed -e 's/^[[:space:]]*//'` |
29 backupFile=./backup/${IRN}${entityId}-${container}.$(date +%Y-%m-%d-%H-%M-%S).backup | 34 backupFile=./backup/${IRN}${entityId}-${container}.$(date +%Y-%m-%d-%H-%M-%S).backup |
30 echo "entityId is $entityId" | 35 echo "entityId is $entityId" |
31 echo "container name is $containerName" | 36 echo "container name is $containerName" |
32 fi | 37 fi |
33 | 38 |
34 ## if database is empty, it will put IRN 000000 | 39 if [ "$container" = "workflowsdb" ]; then |
35 if [ "$IRN" == "" ]; then | 40 function prop { |
36 echo "no IRN set,using 000000" | 41 grep "${1}" .env/ssdt-workflows-shared.properties|cut -d'=' -f2 |
37 IRN=000000 | 42 } |
43 entityId=$(prop 'entityId' | tr -d '"') | |
44 containerName="$entityId-workflows-db" | |
45 backupFile=./backup/${entityId}-${container}.$(date +%Y-%m-%d-%H-%M-%S).backup | |
46 echo "entityId is $entityId" | |
47 echo "container name is $containerName" | |
38 fi | 48 fi |
39 | 49 |
40 echo "Container is $container" | 50 echo "Container is $container" |
41 echo "IRN is $IRN" | 51 echo "IRN is $IRN" |
42 | 52 |